{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "titanic = pd.read_csv('./titanic.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>PassengerId</th>\n",
       "      <th>Survived</th>\n",
       "      <th>Pclass</th>\n",
       "      <th>Name</th>\n",
       "      <th>Sex</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Ticket</th>\n",
       "      <th>Fare</th>\n",
       "      <th>Cabin</th>\n",
       "      <th>Embarked</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Braund, Mr. Owen Harris</td>\n",
       "      <td>male</td>\n",
       "      <td>22.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>A/5 21171</td>\n",
       "      <td>7.2500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Cumings, Mrs. John Bradley (Florence Briggs Th...</td>\n",
       "      <td>female</td>\n",
       "      <td>38.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>PC 17599</td>\n",
       "      <td>71.2833</td>\n",
       "      <td>C85</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>Heikkinen, Miss. Laina</td>\n",
       "      <td>female</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>STON/O2. 3101282</td>\n",
       "      <td>7.9250</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Futrelle, Mrs. Jacques Heath (Lily May Peel)</td>\n",
       "      <td>female</td>\n",
       "      <td>35.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>113803</td>\n",
       "      <td>53.1000</td>\n",
       "      <td>C123</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Allen, Mr. William Henry</td>\n",
       "      <td>male</td>\n",
       "      <td>35.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>373450</td>\n",
       "      <td>8.0500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Moran, Mr. James</td>\n",
       "      <td>male</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>330877</td>\n",
       "      <td>8.4583</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Q</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>7</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>McCarthy, Mr. Timothy J</td>\n",
       "      <td>male</td>\n",
       "      <td>54.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>17463</td>\n",
       "      <td>51.8625</td>\n",
       "      <td>E46</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>8</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Palsson, Master. Gosta Leonard</td>\n",
       "      <td>male</td>\n",
       "      <td>2.0</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>349909</td>\n",
       "      <td>21.0750</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>9</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>Johnson, Mrs. Oscar W (Elisabeth Vilhelmina Berg)</td>\n",
       "      <td>female</td>\n",
       "      <td>27.0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>347742</td>\n",
       "      <td>11.1333</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>10</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>Nasser, Mrs. Nicholas (Adele Achem)</td>\n",
       "      <td>female</td>\n",
       "      <td>14.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>237736</td>\n",
       "      <td>30.0708</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   PassengerId  Survived  Pclass  \\\n",
       "0            1         0       3   \n",
       "1            2         1       1   \n",
       "2            3         1       3   \n",
       "3            4         1       1   \n",
       "4            5         0       3   \n",
       "5            6         0       3   \n",
       "6            7         0       1   \n",
       "7            8         0       3   \n",
       "8            9         1       3   \n",
       "9           10         1       2   \n",
       "\n",
       "                                                Name     Sex   Age  SibSp  \\\n",
       "0                            Braund, Mr. Owen Harris    male  22.0      1   \n",
       "1  Cumings, Mrs. John Bradley (Florence Briggs Th...  female  38.0      1   \n",
       "2                             Heikkinen, Miss. Laina  female  26.0      0   \n",
       "3       Futrelle, Mrs. Jacques Heath (Lily May Peel)  female  35.0      1   \n",
       "4                           Allen, Mr. William Henry    male  35.0      0   \n",
       "5                                   Moran, Mr. James    male   NaN      0   \n",
       "6                            McCarthy, Mr. Timothy J    male  54.0      0   \n",
       "7                     Palsson, Master. Gosta Leonard    male   2.0      3   \n",
       "8  Johnson, Mrs. Oscar W (Elisabeth Vilhelmina Berg)  female  27.0      0   \n",
       "9                Nasser, Mrs. Nicholas (Adele Achem)  female  14.0      1   \n",
       "\n",
       "   Parch            Ticket     Fare Cabin Embarked  \n",
       "0      0         A/5 21171   7.2500   NaN        S  \n",
       "1      0          PC 17599  71.2833   C85        C  \n",
       "2      0  STON/O2. 3101282   7.9250   NaN        S  \n",
       "3      0            113803  53.1000  C123        S  \n",
       "4      0            373450   8.0500   NaN        S  \n",
       "5      0            330877   8.4583   NaN        Q  \n",
       "6      0             17463  51.8625   E46        S  \n",
       "7      1            349909  21.0750   NaN        S  \n",
       "8      2            347742  11.1333   NaN        S  \n",
       "9      0            237736  30.0708   NaN        C  "
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "titanic.head(10)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 问题1：按性别为数据分组？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'female': Int64Index([  1,   2,   3,   8,   9,  10,  11,  14,  15,  18,\n",
       "             ...\n",
       "             866, 871, 874, 875, 879, 880, 882, 885, 887, 888],\n",
       "            dtype='int64', length=314),\n",
       " 'male': Int64Index([  0,   4,   5,   6,   7,  12,  13,  16,  17,  20,\n",
       "             ...\n",
       "             873, 876, 877, 878, 881, 883, 884, 886, 889, 890],\n",
       "            dtype='int64', length=577)}"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sex_group = titanic.groupby(titanic.Sex)\n",
    "sex_group.groups"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>PassengerId</th>\n",
       "      <th>Survived</th>\n",
       "      <th>Pclass</th>\n",
       "      <th>Name</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Ticket</th>\n",
       "      <th>Fare</th>\n",
       "      <th>Cabin</th>\n",
       "      <th>Embarked</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Sex</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>female</th>\n",
       "      <td>314</td>\n",
       "      <td>314</td>\n",
       "      <td>314</td>\n",
       "      <td>314</td>\n",
       "      <td>261</td>\n",
       "      <td>314</td>\n",
       "      <td>314</td>\n",
       "      <td>314</td>\n",
       "      <td>314</td>\n",
       "      <td>97</td>\n",
       "      <td>312</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>male</th>\n",
       "      <td>577</td>\n",
       "      <td>577</td>\n",
       "      <td>577</td>\n",
       "      <td>577</td>\n",
       "      <td>453</td>\n",
       "      <td>577</td>\n",
       "      <td>577</td>\n",
       "      <td>577</td>\n",
       "      <td>577</td>\n",
       "      <td>107</td>\n",
       "      <td>577</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        PassengerId  Survived  Pclass  Name  Age  SibSp  Parch  Ticket  Fare  \\\n",
       "Sex                                                                            \n",
       "female          314       314     314   314  261    314    314     314   314   \n",
       "male            577       577     577   577  453    577    577     577   577   \n",
       "\n",
       "        Cabin  Embarked  \n",
       "Sex                      \n",
       "female     97       312  \n",
       "male      107       577  "
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sex_group.count()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>PassengerId</th>\n",
       "      <th>Survived</th>\n",
       "      <th>Pclass</th>\n",
       "      <th>Name</th>\n",
       "      <th>Sex</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Ticket</th>\n",
       "      <th>Fare</th>\n",
       "      <th>Cabin</th>\n",
       "      <th>Embarked</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Braund, Mr. Owen Harris</td>\n",
       "      <td>male</td>\n",
       "      <td>22.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>A/5 21171</td>\n",
       "      <td>7.2500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Allen, Mr. William Henry</td>\n",
       "      <td>male</td>\n",
       "      <td>35.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>373450</td>\n",
       "      <td>8.0500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Moran, Mr. James</td>\n",
       "      <td>male</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>330877</td>\n",
       "      <td>8.4583</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Q</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>7</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>McCarthy, Mr. Timothy J</td>\n",
       "      <td>male</td>\n",
       "      <td>54.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>17463</td>\n",
       "      <td>51.8625</td>\n",
       "      <td>E46</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>8</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Palsson, Master. Gosta Leonard</td>\n",
       "      <td>male</td>\n",
       "      <td>2.0</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>349909</td>\n",
       "      <td>21.0750</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>13</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Saundercock, Mr. William Henry</td>\n",
       "      <td>male</td>\n",
       "      <td>20.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>A/5. 2151</td>\n",
       "      <td>8.0500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>14</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Andersson, Mr. Anders Johan</td>\n",
       "      <td>male</td>\n",
       "      <td>39.0</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "      <td>347082</td>\n",
       "      <td>31.2750</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>17</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Rice, Master. Eugene</td>\n",
       "      <td>male</td>\n",
       "      <td>2.0</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>382652</td>\n",
       "      <td>29.1250</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Q</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>18</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>Williams, Mr. Charles Eugene</td>\n",
       "      <td>male</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>244373</td>\n",
       "      <td>13.0000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>21</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>Fynney, Mr. Joseph J</td>\n",
       "      <td>male</td>\n",
       "      <td>35.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>239865</td>\n",
       "      <td>26.0000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>22</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>Beesley, Mr. Lawrence</td>\n",
       "      <td>male</td>\n",
       "      <td>34.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>248698</td>\n",
       "      <td>13.0000</td>\n",
       "      <td>D56</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>24</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Sloper, Mr. William Thompson</td>\n",
       "      <td>male</td>\n",
       "      <td>28.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>113788</td>\n",
       "      <td>35.5000</td>\n",
       "      <td>A6</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>27</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Emir, Mr. Farred Chehab</td>\n",
       "      <td>male</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2631</td>\n",
       "      <td>7.2250</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>28</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>Fortune, Mr. Charles Alexander</td>\n",
       "      <td>male</td>\n",
       "      <td>19.0</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>19950</td>\n",
       "      <td>263.0000</td>\n",
       "      <td>C23 C25 C27</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>30</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Todoroff, Mr. Lalio</td>\n",
       "      <td>male</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>349216</td>\n",
       "      <td>7.8958</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>31</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>Uruchurtu, Don. Manuel E</td>\n",
       "      <td>male</td>\n",
       "      <td>40.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>PC 17601</td>\n",
       "      <td>27.7208</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>34</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>Wheadon, Mr. Edward H</td>\n",
       "      <td>male</td>\n",
       "      <td>66.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>C.A. 24579</td>\n",
       "      <td>10.5000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>35</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>Meyer, Mr. Edgar Joseph</td>\n",
       "      <td>male</td>\n",
       "      <td>28.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>PC 17604</td>\n",
       "      <td>82.1708</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>36</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>Holverson, Mr. Alexander Oskar</td>\n",
       "      <td>male</td>\n",
       "      <td>42.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>113789</td>\n",
       "      <td>52.0000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>37</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>Mamee, Mr. Hanna</td>\n",
       "      <td>male</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2677</td>\n",
       "      <td>7.2292</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>38</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Cann, Mr. Ernest Charles</td>\n",
       "      <td>male</td>\n",
       "      <td>21.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>A./5. 2152</td>\n",
       "      <td>8.0500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>42</th>\n",
       "      <td>43</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Kraeff, Mr. Theodor</td>\n",
       "      <td>male</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>349253</td>\n",
       "      <td>7.8958</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>45</th>\n",
       "      <td>46</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Rogers, Mr. William John</td>\n",
       "      <td>male</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>S.C./A.4. 23567</td>\n",
       "      <td>8.0500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>46</th>\n",
       "      <td>47</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Lennon, Mr. Denis</td>\n",
       "      <td>male</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>370371</td>\n",
       "      <td>15.5000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Q</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>48</th>\n",
       "      <td>49</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Samaan, Mr. Youssef</td>\n",
       "      <td>male</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>2662</td>\n",
       "      <td>21.6792</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50</th>\n",
       "      <td>51</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Panula, Master. Juha Niilo</td>\n",
       "      <td>male</td>\n",
       "      <td>7.0</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>3101295</td>\n",
       "      <td>39.6875</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>51</th>\n",
       "      <td>52</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Nosworthy, Mr. Richard Cater</td>\n",
       "      <td>male</td>\n",
       "      <td>21.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>A/4. 39886</td>\n",
       "      <td>7.8000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>54</th>\n",
       "      <td>55</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>Ostby, Mr. Engelhart Cornelius</td>\n",
       "      <td>male</td>\n",
       "      <td>65.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>113509</td>\n",
       "      <td>61.9792</td>\n",
       "      <td>B30</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>55</th>\n",
       "      <td>56</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Woolner, Mr. Hugh</td>\n",
       "      <td>male</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>19947</td>\n",
       "      <td>35.5000</td>\n",
       "      <td>C52</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>57</th>\n",
       "      <td>58</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Novel, Mr. Mansouer</td>\n",
       "      <td>male</td>\n",
       "      <td>28.5</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2697</td>\n",
       "      <td>7.2292</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>840</th>\n",
       "      <td>841</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Alhomaki, Mr. Ilmari Rudolf</td>\n",
       "      <td>male</td>\n",
       "      <td>20.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>SOTON/O2 3101287</td>\n",
       "      <td>7.9250</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>841</th>\n",
       "      <td>842</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>Mudd, Mr. Thomas Charles</td>\n",
       "      <td>male</td>\n",
       "      <td>16.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>S.O./P.P. 3</td>\n",
       "      <td>10.5000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>843</th>\n",
       "      <td>844</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Lemberopolous, Mr. Peter L</td>\n",
       "      <td>male</td>\n",
       "      <td>34.5</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2683</td>\n",
       "      <td>6.4375</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>844</th>\n",
       "      <td>845</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Culumovic, Mr. Jeso</td>\n",
       "      <td>male</td>\n",
       "      <td>17.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>315090</td>\n",
       "      <td>8.6625</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>845</th>\n",
       "      <td>846</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Abbing, Mr. Anthony</td>\n",
       "      <td>male</td>\n",
       "      <td>42.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>C.A. 5547</td>\n",
       "      <td>7.5500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>846</th>\n",
       "      <td>847</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Sage, Mr. Douglas Bullen</td>\n",
       "      <td>male</td>\n",
       "      <td>NaN</td>\n",
       "      <td>8</td>\n",
       "      <td>2</td>\n",
       "      <td>CA. 2343</td>\n",
       "      <td>69.5500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>847</th>\n",
       "      <td>848</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Markoff, Mr. Marin</td>\n",
       "      <td>male</td>\n",
       "      <td>35.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>349213</td>\n",
       "      <td>7.8958</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>848</th>\n",
       "      <td>849</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>Harper, Rev. John</td>\n",
       "      <td>male</td>\n",
       "      <td>28.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>248727</td>\n",
       "      <td>33.0000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>850</th>\n",
       "      <td>851</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Andersson, Master. Sigvard Harald Elias</td>\n",
       "      <td>male</td>\n",
       "      <td>4.0</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>347082</td>\n",
       "      <td>31.2750</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>851</th>\n",
       "      <td>852</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Svensson, Mr. Johan</td>\n",
       "      <td>male</td>\n",
       "      <td>74.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>347060</td>\n",
       "      <td>7.7750</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>857</th>\n",
       "      <td>858</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Daly, Mr. Peter Denis</td>\n",
       "      <td>male</td>\n",
       "      <td>51.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>113055</td>\n",
       "      <td>26.5500</td>\n",
       "      <td>E17</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>859</th>\n",
       "      <td>860</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Razi, Mr. Raihed</td>\n",
       "      <td>male</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2629</td>\n",
       "      <td>7.2292</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>860</th>\n",
       "      <td>861</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Hansen, Mr. Claus Peter</td>\n",
       "      <td>male</td>\n",
       "      <td>41.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>350026</td>\n",
       "      <td>14.1083</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>861</th>\n",
       "      <td>862</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>Giles, Mr. Frederick Edward</td>\n",
       "      <td>male</td>\n",
       "      <td>21.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>28134</td>\n",
       "      <td>11.5000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>864</th>\n",
       "      <td>865</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>Gill, Mr. John William</td>\n",
       "      <td>male</td>\n",
       "      <td>24.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>233866</td>\n",
       "      <td>13.0000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>867</th>\n",
       "      <td>868</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>Roebling, Mr. Washington Augustus II</td>\n",
       "      <td>male</td>\n",
       "      <td>31.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>PC 17590</td>\n",
       "      <td>50.4958</td>\n",
       "      <td>A24</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>868</th>\n",
       "      <td>869</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>van Melkebeke, Mr. Philemon</td>\n",
       "      <td>male</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>345777</td>\n",
       "      <td>9.5000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>869</th>\n",
       "      <td>870</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>Johnson, Master. Harold Theodor</td>\n",
       "      <td>male</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>347742</td>\n",
       "      <td>11.1333</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>870</th>\n",
       "      <td>871</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Balkic, Mr. Cerin</td>\n",
       "      <td>male</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>349248</td>\n",
       "      <td>7.8958</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>872</th>\n",
       "      <td>873</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>Carlsson, Mr. Frans Olof</td>\n",
       "      <td>male</td>\n",
       "      <td>33.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>695</td>\n",
       "      <td>5.0000</td>\n",
       "      <td>B51 B53 B55</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>873</th>\n",
       "      <td>874</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Vander Cruyssen, Mr. Victor</td>\n",
       "      <td>male</td>\n",
       "      <td>47.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>345765</td>\n",
       "      <td>9.0000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>876</th>\n",
       "      <td>877</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Gustafsson, Mr. Alfred Ossian</td>\n",
       "      <td>male</td>\n",
       "      <td>20.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>7534</td>\n",
       "      <td>9.8458</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>877</th>\n",
       "      <td>878</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Petroff, Mr. Nedelio</td>\n",
       "      <td>male</td>\n",
       "      <td>19.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>349212</td>\n",
       "      <td>7.8958</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>878</th>\n",
       "      <td>879</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Laleff, Mr. Kristo</td>\n",
       "      <td>male</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>349217</td>\n",
       "      <td>7.8958</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>881</th>\n",
       "      <td>882</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Markun, Mr. Johann</td>\n",
       "      <td>male</td>\n",
       "      <td>33.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>349257</td>\n",
       "      <td>7.8958</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>883</th>\n",
       "      <td>884</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>Banfield, Mr. Frederick James</td>\n",
       "      <td>male</td>\n",
       "      <td>28.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>C.A./SOTON 34068</td>\n",
       "      <td>10.5000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>884</th>\n",
       "      <td>885</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Sutehall, Mr. Henry Jr</td>\n",
       "      <td>male</td>\n",
       "      <td>25.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>SOTON/OQ 392076</td>\n",
       "      <td>7.0500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>886</th>\n",
       "      <td>887</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>Montvila, Rev. Juozas</td>\n",
       "      <td>male</td>\n",
       "      <td>27.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>211536</td>\n",
       "      <td>13.0000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>889</th>\n",
       "      <td>890</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Behr, Mr. Karl Howell</td>\n",
       "      <td>male</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>111369</td>\n",
       "      <td>30.0000</td>\n",
       "      <td>C148</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>890</th>\n",
       "      <td>891</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Dooley, Mr. Patrick</td>\n",
       "      <td>male</td>\n",
       "      <td>32.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>370376</td>\n",
       "      <td>7.7500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Q</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>577 rows × 12 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     PassengerId  Survived  Pclass                                     Name  \\\n",
       "0              1         0       3                  Braund, Mr. Owen Harris   \n",
       "4              5         0       3                 Allen, Mr. William Henry   \n",
       "5              6         0       3                         Moran, Mr. James   \n",
       "6              7         0       1                  McCarthy, Mr. Timothy J   \n",
       "7              8         0       3           Palsson, Master. Gosta Leonard   \n",
       "12            13         0       3           Saundercock, Mr. William Henry   \n",
       "13            14         0       3              Andersson, Mr. Anders Johan   \n",
       "16            17         0       3                     Rice, Master. Eugene   \n",
       "17            18         1       2             Williams, Mr. Charles Eugene   \n",
       "20            21         0       2                     Fynney, Mr. Joseph J   \n",
       "21            22         1       2                    Beesley, Mr. Lawrence   \n",
       "23            24         1       1             Sloper, Mr. William Thompson   \n",
       "26            27         0       3                  Emir, Mr. Farred Chehab   \n",
       "27            28         0       1           Fortune, Mr. Charles Alexander   \n",
       "29            30         0       3                      Todoroff, Mr. Lalio   \n",
       "30            31         0       1                 Uruchurtu, Don. Manuel E   \n",
       "33            34         0       2                    Wheadon, Mr. Edward H   \n",
       "34            35         0       1                  Meyer, Mr. Edgar Joseph   \n",
       "35            36         0       1           Holverson, Mr. Alexander Oskar   \n",
       "36            37         1       3                         Mamee, Mr. Hanna   \n",
       "37            38         0       3                 Cann, Mr. Ernest Charles   \n",
       "42            43         0       3                      Kraeff, Mr. Theodor   \n",
       "45            46         0       3                 Rogers, Mr. William John   \n",
       "46            47         0       3                        Lennon, Mr. Denis   \n",
       "48            49         0       3                      Samaan, Mr. Youssef   \n",
       "50            51         0       3               Panula, Master. Juha Niilo   \n",
       "51            52         0       3             Nosworthy, Mr. Richard Cater   \n",
       "54            55         0       1           Ostby, Mr. Engelhart Cornelius   \n",
       "55            56         1       1                        Woolner, Mr. Hugh   \n",
       "57            58         0       3                      Novel, Mr. Mansouer   \n",
       "..           ...       ...     ...                                      ...   \n",
       "840          841         0       3              Alhomaki, Mr. Ilmari Rudolf   \n",
       "841          842         0       2                 Mudd, Mr. Thomas Charles   \n",
       "843          844         0       3               Lemberopolous, Mr. Peter L   \n",
       "844          845         0       3                      Culumovic, Mr. Jeso   \n",
       "845          846         0       3                      Abbing, Mr. Anthony   \n",
       "846          847         0       3                 Sage, Mr. Douglas Bullen   \n",
       "847          848         0       3                       Markoff, Mr. Marin   \n",
       "848          849         0       2                        Harper, Rev. John   \n",
       "850          851         0       3  Andersson, Master. Sigvard Harald Elias   \n",
       "851          852         0       3                      Svensson, Mr. Johan   \n",
       "857          858         1       1                   Daly, Mr. Peter Denis    \n",
       "859          860         0       3                         Razi, Mr. Raihed   \n",
       "860          861         0       3                  Hansen, Mr. Claus Peter   \n",
       "861          862         0       2              Giles, Mr. Frederick Edward   \n",
       "864          865         0       2                   Gill, Mr. John William   \n",
       "867          868         0       1     Roebling, Mr. Washington Augustus II   \n",
       "868          869         0       3              van Melkebeke, Mr. Philemon   \n",
       "869          870         1       3          Johnson, Master. Harold Theodor   \n",
       "870          871         0       3                        Balkic, Mr. Cerin   \n",
       "872          873         0       1                 Carlsson, Mr. Frans Olof   \n",
       "873          874         0       3              Vander Cruyssen, Mr. Victor   \n",
       "876          877         0       3            Gustafsson, Mr. Alfred Ossian   \n",
       "877          878         0       3                     Petroff, Mr. Nedelio   \n",
       "878          879         0       3                       Laleff, Mr. Kristo   \n",
       "881          882         0       3                       Markun, Mr. Johann   \n",
       "883          884         0       2            Banfield, Mr. Frederick James   \n",
       "884          885         0       3                   Sutehall, Mr. Henry Jr   \n",
       "886          887         0       2                    Montvila, Rev. Juozas   \n",
       "889          890         1       1                    Behr, Mr. Karl Howell   \n",
       "890          891         0       3                      Dooley, Mr. Patrick   \n",
       "\n",
       "      Sex   Age  SibSp  Parch            Ticket      Fare        Cabin  \\\n",
       "0    male  22.0      1      0         A/5 21171    7.2500          NaN   \n",
       "4    male  35.0      0      0            373450    8.0500          NaN   \n",
       "5    male   NaN      0      0            330877    8.4583          NaN   \n",
       "6    male  54.0      0      0             17463   51.8625          E46   \n",
       "7    male   2.0      3      1            349909   21.0750          NaN   \n",
       "12   male  20.0      0      0         A/5. 2151    8.0500          NaN   \n",
       "13   male  39.0      1      5            347082   31.2750          NaN   \n",
       "16   male   2.0      4      1            382652   29.1250          NaN   \n",
       "17   male   NaN      0      0            244373   13.0000          NaN   \n",
       "20   male  35.0      0      0            239865   26.0000          NaN   \n",
       "21   male  34.0      0      0            248698   13.0000          D56   \n",
       "23   male  28.0      0      0            113788   35.5000           A6   \n",
       "26   male   NaN      0      0              2631    7.2250          NaN   \n",
       "27   male  19.0      3      2             19950  263.0000  C23 C25 C27   \n",
       "29   male   NaN      0      0            349216    7.8958          NaN   \n",
       "30   male  40.0      0      0          PC 17601   27.7208          NaN   \n",
       "33   male  66.0      0      0        C.A. 24579   10.5000          NaN   \n",
       "34   male  28.0      1      0          PC 17604   82.1708          NaN   \n",
       "35   male  42.0      1      0            113789   52.0000          NaN   \n",
       "36   male   NaN      0      0              2677    7.2292          NaN   \n",
       "37   male  21.0      0      0        A./5. 2152    8.0500          NaN   \n",
       "42   male   NaN      0      0            349253    7.8958          NaN   \n",
       "45   male   NaN      0      0   S.C./A.4. 23567    8.0500          NaN   \n",
       "46   male   NaN      1      0            370371   15.5000          NaN   \n",
       "48   male   NaN      2      0              2662   21.6792          NaN   \n",
       "50   male   7.0      4      1           3101295   39.6875          NaN   \n",
       "51   male  21.0      0      0        A/4. 39886    7.8000          NaN   \n",
       "54   male  65.0      0      1            113509   61.9792          B30   \n",
       "55   male   NaN      0      0             19947   35.5000          C52   \n",
       "57   male  28.5      0      0              2697    7.2292          NaN   \n",
       "..    ...   ...    ...    ...               ...       ...          ...   \n",
       "840  male  20.0      0      0  SOTON/O2 3101287    7.9250          NaN   \n",
       "841  male  16.0      0      0       S.O./P.P. 3   10.5000          NaN   \n",
       "843  male  34.5      0      0              2683    6.4375          NaN   \n",
       "844  male  17.0      0      0            315090    8.6625          NaN   \n",
       "845  male  42.0      0      0         C.A. 5547    7.5500          NaN   \n",
       "846  male   NaN      8      2          CA. 2343   69.5500          NaN   \n",
       "847  male  35.0      0      0            349213    7.8958          NaN   \n",
       "848  male  28.0      0      1            248727   33.0000          NaN   \n",
       "850  male   4.0      4      2            347082   31.2750          NaN   \n",
       "851  male  74.0      0      0            347060    7.7750          NaN   \n",
       "857  male  51.0      0      0            113055   26.5500          E17   \n",
       "859  male   NaN      0      0              2629    7.2292          NaN   \n",
       "860  male  41.0      2      0            350026   14.1083          NaN   \n",
       "861  male  21.0      1      0             28134   11.5000          NaN   \n",
       "864  male  24.0      0      0            233866   13.0000          NaN   \n",
       "867  male  31.0      0      0          PC 17590   50.4958          A24   \n",
       "868  male   NaN      0      0            345777    9.5000          NaN   \n",
       "869  male   4.0      1      1            347742   11.1333          NaN   \n",
       "870  male  26.0      0      0            349248    7.8958          NaN   \n",
       "872  male  33.0      0      0               695    5.0000  B51 B53 B55   \n",
       "873  male  47.0      0      0            345765    9.0000          NaN   \n",
       "876  male  20.0      0      0              7534    9.8458          NaN   \n",
       "877  male  19.0      0      0            349212    7.8958          NaN   \n",
       "878  male   NaN      0      0            349217    7.8958          NaN   \n",
       "881  male  33.0      0      0            349257    7.8958          NaN   \n",
       "883  male  28.0      0      0  C.A./SOTON 34068   10.5000          NaN   \n",
       "884  male  25.0      0      0   SOTON/OQ 392076    7.0500          NaN   \n",
       "886  male  27.0      0      0            211536   13.0000          NaN   \n",
       "889  male  26.0      0      0            111369   30.0000         C148   \n",
       "890  male  32.0      0      0            370376    7.7500          NaN   \n",
       "\n",
       "    Embarked  \n",
       "0          S  \n",
       "4          S  \n",
       "5          Q  \n",
       "6          S  \n",
       "7          S  \n",
       "12         S  \n",
       "13         S  \n",
       "16         Q  \n",
       "17         S  \n",
       "20         S  \n",
       "21         S  \n",
       "23         S  \n",
       "26         C  \n",
       "27         S  \n",
       "29         S  \n",
       "30         C  \n",
       "33         S  \n",
       "34         C  \n",
       "35         S  \n",
       "36         C  \n",
       "37         S  \n",
       "42         C  \n",
       "45         S  \n",
       "46         Q  \n",
       "48         C  \n",
       "50         S  \n",
       "51         S  \n",
       "54         C  \n",
       "55         S  \n",
       "57         C  \n",
       "..       ...  \n",
       "840        S  \n",
       "841        S  \n",
       "843        C  \n",
       "844        S  \n",
       "845        S  \n",
       "846        S  \n",
       "847        C  \n",
       "848        S  \n",
       "850        S  \n",
       "851        S  \n",
       "857        S  \n",
       "859        C  \n",
       "860        S  \n",
       "861        S  \n",
       "864        S  \n",
       "867        S  \n",
       "868        S  \n",
       "869        S  \n",
       "870        S  \n",
       "872        S  \n",
       "873        S  \n",
       "876        S  \n",
       "877        S  \n",
       "878        S  \n",
       "881        S  \n",
       "883        S  \n",
       "884        S  \n",
       "886        S  \n",
       "889        C  \n",
       "890        Q  \n",
       "\n",
       "[577 rows x 12 columns]"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sex_group.get_group('male')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>PassengerId</th>\n",
       "      <th>Survived</th>\n",
       "      <th>Pclass</th>\n",
       "      <th>Name</th>\n",
       "      <th>Sex</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Ticket</th>\n",
       "      <th>Fare</th>\n",
       "      <th>Cabin</th>\n",
       "      <th>Embarked</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Cumings, Mrs. John Bradley (Florence Briggs Th...</td>\n",
       "      <td>female</td>\n",
       "      <td>38.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>PC 17599</td>\n",
       "      <td>71.2833</td>\n",
       "      <td>C85</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>Heikkinen, Miss. Laina</td>\n",
       "      <td>female</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>STON/O2. 3101282</td>\n",
       "      <td>7.9250</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Futrelle, Mrs. Jacques Heath (Lily May Peel)</td>\n",
       "      <td>female</td>\n",
       "      <td>35.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>113803</td>\n",
       "      <td>53.1000</td>\n",
       "      <td>C123</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>9</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>Johnson, Mrs. Oscar W (Elisabeth Vilhelmina Berg)</td>\n",
       "      <td>female</td>\n",
       "      <td>27.0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>347742</td>\n",
       "      <td>11.1333</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>10</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>Nasser, Mrs. Nicholas (Adele Achem)</td>\n",
       "      <td>female</td>\n",
       "      <td>14.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>237736</td>\n",
       "      <td>30.0708</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>11</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>Sandstrom, Miss. Marguerite Rut</td>\n",
       "      <td>female</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>PP 9549</td>\n",
       "      <td>16.7000</td>\n",
       "      <td>G6</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>12</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Bonnell, Miss. Elizabeth</td>\n",
       "      <td>female</td>\n",
       "      <td>58.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>113783</td>\n",
       "      <td>26.5500</td>\n",
       "      <td>C103</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>15</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Vestrom, Miss. Hulda Amanda Adolfina</td>\n",
       "      <td>female</td>\n",
       "      <td>14.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>350406</td>\n",
       "      <td>7.8542</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>16</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>Hewlett, Mrs. (Mary D Kingcome)</td>\n",
       "      <td>female</td>\n",
       "      <td>55.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>248706</td>\n",
       "      <td>16.0000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>19</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Vander Planke, Mrs. Julius (Emelia Maria Vande...</td>\n",
       "      <td>female</td>\n",
       "      <td>31.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>345763</td>\n",
       "      <td>18.0000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>20</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>Masselmani, Mrs. Fatima</td>\n",
       "      <td>female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2649</td>\n",
       "      <td>7.2250</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>23</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>McGowan, Miss. Anna \"Annie\"</td>\n",
       "      <td>female</td>\n",
       "      <td>15.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>330923</td>\n",
       "      <td>8.0292</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Q</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>25</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Palsson, Miss. Torborg Danira</td>\n",
       "      <td>female</td>\n",
       "      <td>8.0</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>349909</td>\n",
       "      <td>21.0750</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>26</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>Asplund, Mrs. Carl Oscar (Selma Augusta Emilia...</td>\n",
       "      <td>female</td>\n",
       "      <td>38.0</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "      <td>347077</td>\n",
       "      <td>31.3875</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>29</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>O'Dwyer, Miss. Ellen \"Nellie\"</td>\n",
       "      <td>female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>330959</td>\n",
       "      <td>7.8792</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Q</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>32</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Spencer, Mrs. William Augustus (Marie Eugenie)</td>\n",
       "      <td>female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>PC 17569</td>\n",
       "      <td>146.5208</td>\n",
       "      <td>B78</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>33</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>Glynn, Miss. Mary Agatha</td>\n",
       "      <td>female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>335677</td>\n",
       "      <td>7.7500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Q</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>39</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Vander Planke, Miss. Augusta Maria</td>\n",
       "      <td>female</td>\n",
       "      <td>18.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>345764</td>\n",
       "      <td>18.0000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>40</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>Nicola-Yarred, Miss. Jamila</td>\n",
       "      <td>female</td>\n",
       "      <td>14.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2651</td>\n",
       "      <td>11.2417</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>41</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Ahlin, Mrs. Johan (Johanna Persdotter Larsson)</td>\n",
       "      <td>female</td>\n",
       "      <td>40.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>7546</td>\n",
       "      <td>9.4750</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41</th>\n",
       "      <td>42</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>Turpin, Mrs. William John Robert (Dorothy Ann ...</td>\n",
       "      <td>female</td>\n",
       "      <td>27.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>11668</td>\n",
       "      <td>21.0000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>43</th>\n",
       "      <td>44</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>Laroche, Miss. Simonne Marie Anne Andree</td>\n",
       "      <td>female</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>SC/Paris 2123</td>\n",
       "      <td>41.5792</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>44</th>\n",
       "      <td>45</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>Devaney, Miss. Margaret Delia</td>\n",
       "      <td>female</td>\n",
       "      <td>19.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>330958</td>\n",
       "      <td>7.8792</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Q</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>47</th>\n",
       "      <td>48</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>O'Driscoll, Miss. Bridget</td>\n",
       "      <td>female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>14311</td>\n",
       "      <td>7.7500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Q</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49</th>\n",
       "      <td>50</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Arnold-Franchi, Mrs. Josef (Josefine Franchi)</td>\n",
       "      <td>female</td>\n",
       "      <td>18.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>349237</td>\n",
       "      <td>17.8000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>52</th>\n",
       "      <td>53</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Harper, Mrs. Henry Sleeper (Myna Haxtun)</td>\n",
       "      <td>female</td>\n",
       "      <td>49.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>PC 17572</td>\n",
       "      <td>76.7292</td>\n",
       "      <td>D33</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>53</th>\n",
       "      <td>54</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>Faunthorpe, Mrs. Lizzie (Elizabeth Anne Wilkin...</td>\n",
       "      <td>female</td>\n",
       "      <td>29.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2926</td>\n",
       "      <td>26.0000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>56</th>\n",
       "      <td>57</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>Rugg, Miss. Emily</td>\n",
       "      <td>female</td>\n",
       "      <td>21.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>C.A. 31026</td>\n",
       "      <td>10.5000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>58</th>\n",
       "      <td>59</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>West, Miss. Constance Mirium</td>\n",
       "      <td>female</td>\n",
       "      <td>5.0</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>C.A. 34651</td>\n",
       "      <td>27.7500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>61</th>\n",
       "      <td>62</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Icard, Miss. Amelie</td>\n",
       "      <td>female</td>\n",
       "      <td>38.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>113572</td>\n",
       "      <td>80.0000</td>\n",
       "      <td>B28</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>807</th>\n",
       "      <td>808</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Pettersson, Miss. Ellen Natalia</td>\n",
       "      <td>female</td>\n",
       "      <td>18.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>347087</td>\n",
       "      <td>7.7750</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>809</th>\n",
       "      <td>810</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Chambers, Mrs. Norman Campbell (Bertha Griggs)</td>\n",
       "      <td>female</td>\n",
       "      <td>33.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>113806</td>\n",
       "      <td>53.1000</td>\n",
       "      <td>E8</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>813</th>\n",
       "      <td>814</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Andersson, Miss. Ebba Iris Alfrida</td>\n",
       "      <td>female</td>\n",
       "      <td>6.0</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>347082</td>\n",
       "      <td>31.2750</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>816</th>\n",
       "      <td>817</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Heininen, Miss. Wendla Maria</td>\n",
       "      <td>female</td>\n",
       "      <td>23.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>STON/O2. 3101290</td>\n",
       "      <td>7.9250</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>820</th>\n",
       "      <td>821</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Hays, Mrs. Charles Melville (Clara Jennings Gr...</td>\n",
       "      <td>female</td>\n",
       "      <td>52.0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>12749</td>\n",
       "      <td>93.5000</td>\n",
       "      <td>B69</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>823</th>\n",
       "      <td>824</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>Moor, Mrs. (Beila)</td>\n",
       "      <td>female</td>\n",
       "      <td>27.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>392096</td>\n",
       "      <td>12.4750</td>\n",
       "      <td>E121</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>829</th>\n",
       "      <td>830</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Stone, Mrs. George Nelson (Martha Evelyn)</td>\n",
       "      <td>female</td>\n",
       "      <td>62.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>113572</td>\n",
       "      <td>80.0000</td>\n",
       "      <td>B28</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>830</th>\n",
       "      <td>831</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>Yasbeck, Mrs. Antoni (Selini Alexander)</td>\n",
       "      <td>female</td>\n",
       "      <td>15.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2659</td>\n",
       "      <td>14.4542</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>835</th>\n",
       "      <td>836</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Compton, Miss. Sara Rebecca</td>\n",
       "      <td>female</td>\n",
       "      <td>39.0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>PC 17756</td>\n",
       "      <td>83.1583</td>\n",
       "      <td>E49</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>842</th>\n",
       "      <td>843</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Serepeca, Miss. Augusta</td>\n",
       "      <td>female</td>\n",
       "      <td>30.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>113798</td>\n",
       "      <td>31.0000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>849</th>\n",
       "      <td>850</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Goldenberg, Mrs. Samuel L (Edwiga Grabowska)</td>\n",
       "      <td>female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>17453</td>\n",
       "      <td>89.1042</td>\n",
       "      <td>C92</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>852</th>\n",
       "      <td>853</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Boulos, Miss. Nourelain</td>\n",
       "      <td>female</td>\n",
       "      <td>9.0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2678</td>\n",
       "      <td>15.2458</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>853</th>\n",
       "      <td>854</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Lines, Miss. Mary Conover</td>\n",
       "      <td>female</td>\n",
       "      <td>16.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>PC 17592</td>\n",
       "      <td>39.4000</td>\n",
       "      <td>D28</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>854</th>\n",
       "      <td>855</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>Carter, Mrs. Ernest Courtenay (Lilian Hughes)</td>\n",
       "      <td>female</td>\n",
       "      <td>44.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>244252</td>\n",
       "      <td>26.0000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>855</th>\n",
       "      <td>856</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>Aks, Mrs. Sam (Leah Rosen)</td>\n",
       "      <td>female</td>\n",
       "      <td>18.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>392091</td>\n",
       "      <td>9.3500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>856</th>\n",
       "      <td>857</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Wick, Mrs. George Dennick (Mary Hitchcock)</td>\n",
       "      <td>female</td>\n",
       "      <td>45.0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>36928</td>\n",
       "      <td>164.8667</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>858</th>\n",
       "      <td>859</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>Baclini, Mrs. Solomon (Latifa Qurban)</td>\n",
       "      <td>female</td>\n",
       "      <td>24.0</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>2666</td>\n",
       "      <td>19.2583</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>862</th>\n",
       "      <td>863</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Swift, Mrs. Frederick Joel (Margaret Welles Ba...</td>\n",
       "      <td>female</td>\n",
       "      <td>48.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>17466</td>\n",
       "      <td>25.9292</td>\n",
       "      <td>D17</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>863</th>\n",
       "      <td>864</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Sage, Miss. Dorothy Edith \"Dolly\"</td>\n",
       "      <td>female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>8</td>\n",
       "      <td>2</td>\n",
       "      <td>CA. 2343</td>\n",
       "      <td>69.5500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>865</th>\n",
       "      <td>866</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>Bystrom, Mrs. (Karolina)</td>\n",
       "      <td>female</td>\n",
       "      <td>42.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>236852</td>\n",
       "      <td>13.0000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>866</th>\n",
       "      <td>867</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>Duran y More, Miss. Asuncion</td>\n",
       "      <td>female</td>\n",
       "      <td>27.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>SC/PARIS 2149</td>\n",
       "      <td>13.8583</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>871</th>\n",
       "      <td>872</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Beckwith, Mrs. Richard Leonard (Sallie Monypeny)</td>\n",
       "      <td>female</td>\n",
       "      <td>47.0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>11751</td>\n",
       "      <td>52.5542</td>\n",
       "      <td>D35</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>874</th>\n",
       "      <td>875</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>Abelson, Mrs. Samuel (Hannah Wizosky)</td>\n",
       "      <td>female</td>\n",
       "      <td>28.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>P/PP 3381</td>\n",
       "      <td>24.0000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>875</th>\n",
       "      <td>876</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>Najib, Miss. Adele Kiamie \"Jane\"</td>\n",
       "      <td>female</td>\n",
       "      <td>15.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2667</td>\n",
       "      <td>7.2250</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>879</th>\n",
       "      <td>880</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Potter, Mrs. Thomas Jr (Lily Alexenia Wilson)</td>\n",
       "      <td>female</td>\n",
       "      <td>56.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>11767</td>\n",
       "      <td>83.1583</td>\n",
       "      <td>C50</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>880</th>\n",
       "      <td>881</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>Shelley, Mrs. William (Imanita Parrish Hall)</td>\n",
       "      <td>female</td>\n",
       "      <td>25.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>230433</td>\n",
       "      <td>26.0000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>882</th>\n",
       "      <td>883</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Dahlberg, Miss. Gerda Ulrika</td>\n",
       "      <td>female</td>\n",
       "      <td>22.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>7552</td>\n",
       "      <td>10.5167</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>885</th>\n",
       "      <td>886</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Rice, Mrs. William (Margaret Norton)</td>\n",
       "      <td>female</td>\n",
       "      <td>39.0</td>\n",
       "      <td>0</td>\n",
       "      <td>5</td>\n",
       "      <td>382652</td>\n",
       "      <td>29.1250</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Q</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>887</th>\n",
       "      <td>888</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Graham, Miss. Margaret Edith</td>\n",
       "      <td>female</td>\n",
       "      <td>19.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>112053</td>\n",
       "      <td>30.0000</td>\n",
       "      <td>B42</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>888</th>\n",
       "      <td>889</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Johnston, Miss. Catherine Helen \"Carrie\"</td>\n",
       "      <td>female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>W./C. 6607</td>\n",
       "      <td>23.4500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>314 rows × 12 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     PassengerId  Survived  Pclass  \\\n",
       "1              2         1       1   \n",
       "2              3         1       3   \n",
       "3              4         1       1   \n",
       "8              9         1       3   \n",
       "9             10         1       2   \n",
       "10            11         1       3   \n",
       "11            12         1       1   \n",
       "14            15         0       3   \n",
       "15            16         1       2   \n",
       "18            19         0       3   \n",
       "19            20         1       3   \n",
       "22            23         1       3   \n",
       "24            25         0       3   \n",
       "25            26         1       3   \n",
       "28            29         1       3   \n",
       "31            32         1       1   \n",
       "32            33         1       3   \n",
       "38            39         0       3   \n",
       "39            40         1       3   \n",
       "40            41         0       3   \n",
       "41            42         0       2   \n",
       "43            44         1       2   \n",
       "44            45         1       3   \n",
       "47            48         1       3   \n",
       "49            50         0       3   \n",
       "52            53         1       1   \n",
       "53            54         1       2   \n",
       "56            57         1       2   \n",
       "58            59         1       2   \n",
       "61            62         1       1   \n",
       "..           ...       ...     ...   \n",
       "807          808         0       3   \n",
       "809          810         1       1   \n",
       "813          814         0       3   \n",
       "816          817         0       3   \n",
       "820          821         1       1   \n",
       "823          824         1       3   \n",
       "829          830         1       1   \n",
       "830          831         1       3   \n",
       "835          836         1       1   \n",
       "842          843         1       1   \n",
       "849          850         1       1   \n",
       "852          853         0       3   \n",
       "853          854         1       1   \n",
       "854          855         0       2   \n",
       "855          856         1       3   \n",
       "856          857         1       1   \n",
       "858          859         1       3   \n",
       "862          863         1       1   \n",
       "863          864         0       3   \n",
       "865          866         1       2   \n",
       "866          867         1       2   \n",
       "871          872         1       1   \n",
       "874          875         1       2   \n",
       "875          876         1       3   \n",
       "879          880         1       1   \n",
       "880          881         1       2   \n",
       "882          883         0       3   \n",
       "885          886         0       3   \n",
       "887          888         1       1   \n",
       "888          889         0       3   \n",
       "\n",
       "                                                  Name     Sex   Age  SibSp  \\\n",
       "1    Cumings, Mrs. John Bradley (Florence Briggs Th...  female  38.0      1   \n",
       "2                               Heikkinen, Miss. Laina  female  26.0      0   \n",
       "3         Futrelle, Mrs. Jacques Heath (Lily May Peel)  female  35.0      1   \n",
       "8    Johnson, Mrs. Oscar W (Elisabeth Vilhelmina Berg)  female  27.0      0   \n",
       "9                  Nasser, Mrs. Nicholas (Adele Achem)  female  14.0      1   \n",
       "10                     Sandstrom, Miss. Marguerite Rut  female   4.0      1   \n",
       "11                            Bonnell, Miss. Elizabeth  female  58.0      0   \n",
       "14                Vestrom, Miss. Hulda Amanda Adolfina  female  14.0      0   \n",
       "15                    Hewlett, Mrs. (Mary D Kingcome)   female  55.0      0   \n",
       "18   Vander Planke, Mrs. Julius (Emelia Maria Vande...  female  31.0      1   \n",
       "19                             Masselmani, Mrs. Fatima  female   NaN      0   \n",
       "22                         McGowan, Miss. Anna \"Annie\"  female  15.0      0   \n",
       "24                       Palsson, Miss. Torborg Danira  female   8.0      3   \n",
       "25   Asplund, Mrs. Carl Oscar (Selma Augusta Emilia...  female  38.0      1   \n",
       "28                       O'Dwyer, Miss. Ellen \"Nellie\"  female   NaN      0   \n",
       "31      Spencer, Mrs. William Augustus (Marie Eugenie)  female   NaN      1   \n",
       "32                            Glynn, Miss. Mary Agatha  female   NaN      0   \n",
       "38                  Vander Planke, Miss. Augusta Maria  female  18.0      2   \n",
       "39                         Nicola-Yarred, Miss. Jamila  female  14.0      1   \n",
       "40      Ahlin, Mrs. Johan (Johanna Persdotter Larsson)  female  40.0      1   \n",
       "41   Turpin, Mrs. William John Robert (Dorothy Ann ...  female  27.0      1   \n",
       "43            Laroche, Miss. Simonne Marie Anne Andree  female   3.0      1   \n",
       "44                       Devaney, Miss. Margaret Delia  female  19.0      0   \n",
       "47                           O'Driscoll, Miss. Bridget  female   NaN      0   \n",
       "49       Arnold-Franchi, Mrs. Josef (Josefine Franchi)  female  18.0      1   \n",
       "52            Harper, Mrs. Henry Sleeper (Myna Haxtun)  female  49.0      1   \n",
       "53   Faunthorpe, Mrs. Lizzie (Elizabeth Anne Wilkin...  female  29.0      1   \n",
       "56                                   Rugg, Miss. Emily  female  21.0      0   \n",
       "58                        West, Miss. Constance Mirium  female   5.0      1   \n",
       "61                                 Icard, Miss. Amelie  female  38.0      0   \n",
       "..                                                 ...     ...   ...    ...   \n",
       "807                    Pettersson, Miss. Ellen Natalia  female  18.0      0   \n",
       "809     Chambers, Mrs. Norman Campbell (Bertha Griggs)  female  33.0      1   \n",
       "813                 Andersson, Miss. Ebba Iris Alfrida  female   6.0      4   \n",
       "816                       Heininen, Miss. Wendla Maria  female  23.0      0   \n",
       "820  Hays, Mrs. Charles Melville (Clara Jennings Gr...  female  52.0      1   \n",
       "823                                 Moor, Mrs. (Beila)  female  27.0      0   \n",
       "829          Stone, Mrs. George Nelson (Martha Evelyn)  female  62.0      0   \n",
       "830            Yasbeck, Mrs. Antoni (Selini Alexander)  female  15.0      1   \n",
       "835                        Compton, Miss. Sara Rebecca  female  39.0      1   \n",
       "842                            Serepeca, Miss. Augusta  female  30.0      0   \n",
       "849       Goldenberg, Mrs. Samuel L (Edwiga Grabowska)  female   NaN      1   \n",
       "852                            Boulos, Miss. Nourelain  female   9.0      1   \n",
       "853                          Lines, Miss. Mary Conover  female  16.0      0   \n",
       "854      Carter, Mrs. Ernest Courtenay (Lilian Hughes)  female  44.0      1   \n",
       "855                         Aks, Mrs. Sam (Leah Rosen)  female  18.0      0   \n",
       "856         Wick, Mrs. George Dennick (Mary Hitchcock)  female  45.0      1   \n",
       "858              Baclini, Mrs. Solomon (Latifa Qurban)  female  24.0      0   \n",
       "862  Swift, Mrs. Frederick Joel (Margaret Welles Ba...  female  48.0      0   \n",
       "863                  Sage, Miss. Dorothy Edith \"Dolly\"  female   NaN      8   \n",
       "865                           Bystrom, Mrs. (Karolina)  female  42.0      0   \n",
       "866                       Duran y More, Miss. Asuncion  female  27.0      1   \n",
       "871   Beckwith, Mrs. Richard Leonard (Sallie Monypeny)  female  47.0      1   \n",
       "874              Abelson, Mrs. Samuel (Hannah Wizosky)  female  28.0      1   \n",
       "875                   Najib, Miss. Adele Kiamie \"Jane\"  female  15.0      0   \n",
       "879      Potter, Mrs. Thomas Jr (Lily Alexenia Wilson)  female  56.0      0   \n",
       "880       Shelley, Mrs. William (Imanita Parrish Hall)  female  25.0      0   \n",
       "882                       Dahlberg, Miss. Gerda Ulrika  female  22.0      0   \n",
       "885               Rice, Mrs. William (Margaret Norton)  female  39.0      0   \n",
       "887                       Graham, Miss. Margaret Edith  female  19.0      0   \n",
       "888           Johnston, Miss. Catherine Helen \"Carrie\"  female   NaN      1   \n",
       "\n",
       "     Parch            Ticket      Fare Cabin Embarked  \n",
       "1        0          PC 17599   71.2833   C85        C  \n",
       "2        0  STON/O2. 3101282    7.9250   NaN        S  \n",
       "3        0            113803   53.1000  C123        S  \n",
       "8        2            347742   11.1333   NaN        S  \n",
       "9        0            237736   30.0708   NaN        C  \n",
       "10       1           PP 9549   16.7000    G6        S  \n",
       "11       0            113783   26.5500  C103        S  \n",
       "14       0            350406    7.8542   NaN        S  \n",
       "15       0            248706   16.0000   NaN        S  \n",
       "18       0            345763   18.0000   NaN        S  \n",
       "19       0              2649    7.2250   NaN        C  \n",
       "22       0            330923    8.0292   NaN        Q  \n",
       "24       1            349909   21.0750   NaN        S  \n",
       "25       5            347077   31.3875   NaN        S  \n",
       "28       0            330959    7.8792   NaN        Q  \n",
       "31       0          PC 17569  146.5208   B78        C  \n",
       "32       0            335677    7.7500   NaN        Q  \n",
       "38       0            345764   18.0000   NaN        S  \n",
       "39       0              2651   11.2417   NaN        C  \n",
       "40       0              7546    9.4750   NaN        S  \n",
       "41       0             11668   21.0000   NaN        S  \n",
       "43       2     SC/Paris 2123   41.5792   NaN        C  \n",
       "44       0            330958    7.8792   NaN        Q  \n",
       "47       0             14311    7.7500   NaN        Q  \n",
       "49       0            349237   17.8000   NaN        S  \n",
       "52       0          PC 17572   76.7292   D33        C  \n",
       "53       0              2926   26.0000   NaN        S  \n",
       "56       0        C.A. 31026   10.5000   NaN        S  \n",
       "58       2        C.A. 34651   27.7500   NaN        S  \n",
       "61       0            113572   80.0000   B28      NaN  \n",
       "..     ...               ...       ...   ...      ...  \n",
       "807      0            347087    7.7750   NaN        S  \n",
       "809      0            113806   53.1000    E8        S  \n",
       "813      2            347082   31.2750   NaN        S  \n",
       "816      0  STON/O2. 3101290    7.9250   NaN        S  \n",
       "820      1             12749   93.5000   B69        S  \n",
       "823      1            392096   12.4750  E121        S  \n",
       "829      0            113572   80.0000   B28      NaN  \n",
       "830      0              2659   14.4542   NaN        C  \n",
       "835      1          PC 17756   83.1583   E49        C  \n",
       "842      0            113798   31.0000   NaN        C  \n",
       "849      0             17453   89.1042   C92        C  \n",
       "852      1              2678   15.2458   NaN        C  \n",
       "853      1          PC 17592   39.4000   D28        S  \n",
       "854      0            244252   26.0000   NaN        S  \n",
       "855      1            392091    9.3500   NaN        S  \n",
       "856      1             36928  164.8667   NaN        S  \n",
       "858      3              2666   19.2583   NaN        C  \n",
       "862      0             17466   25.9292   D17        S  \n",
       "863      2          CA. 2343   69.5500   NaN        S  \n",
       "865      0            236852   13.0000   NaN        S  \n",
       "866      0     SC/PARIS 2149   13.8583   NaN        C  \n",
       "871      1             11751   52.5542   D35        S  \n",
       "874      0         P/PP 3381   24.0000   NaN        C  \n",
       "875      0              2667    7.2250   NaN        C  \n",
       "879      1             11767   83.1583   C50        C  \n",
       "880      1            230433   26.0000   NaN        S  \n",
       "882      0              7552   10.5167   NaN        S  \n",
       "885      5            382652   29.1250   NaN        Q  \n",
       "887      0            112053   30.0000   B42        S  \n",
       "888      2        W./C. 6607   23.4500   NaN        S  \n",
       "\n",
       "[314 rows x 12 columns]"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sex_group.get_group('female')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Sex\n",
       "female    233\n",
       "male      109\n",
       "Name: Survived, dtype: int64"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sex_group.Survived.sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>Survived</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Sex</th>\n",
       "      <th>Survived</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">female</th>\n",
       "      <th>0</th>\n",
       "      <td>81</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>233</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">male</th>\n",
       "      <th>0</th>\n",
       "      <td>468</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>109</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                 Survived\n",
       "Sex    Survived          \n",
       "female 0               81\n",
       "       1              233\n",
       "male   0              468\n",
       "       1              109"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "titanic.groupby([titanic.Sex, titanic.Survived])[['Survived']].count()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 问题2：如何同时对性别与年龄分组？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "PassengerId    290\n",
       "Survived       290\n",
       "Pclass         290\n",
       "Name           290\n",
       "Sex            290\n",
       "Age            290\n",
       "SibSp          290\n",
       "Parch          290\n",
       "Ticket         290\n",
       "Fare           290\n",
       "Cabin          125\n",
       "Embarked       288\n",
       "dtype: int64"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "titanic[(titanic.Survived == 1) & titanic.Age.notna()].count()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "sex_age_group = titanic.groupby([titanic.Age, titanic.Sex])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Age    Sex   \n",
       "0.42   male      1\n",
       "0.67   male      1\n",
       "0.75   female    2\n",
       "0.83   male      2\n",
       "0.92   male      1\n",
       "1.00   female    2\n",
       "       male      3\n",
       "2.00   female    2\n",
       "       male      1\n",
       "3.00   female    1\n",
       "       male      4\n",
       "4.00   female    5\n",
       "       male      2\n",
       "5.00   female    4\n",
       "6.00   female    1\n",
       "       male      1\n",
       "7.00   female    1\n",
       "       male      0\n",
       "8.00   female    1\n",
       "       male      1\n",
       "9.00   female    0\n",
       "       male      2\n",
       "10.00  female    0\n",
       "       male      0\n",
       "11.00  female    0\n",
       "       male      1\n",
       "12.00  male      1\n",
       "13.00  female    2\n",
       "14.00  female    3\n",
       "       male      0\n",
       "                ..\n",
       "51.00  male      1\n",
       "52.00  female    2\n",
       "       male      1\n",
       "53.00  female    1\n",
       "54.00  female    3\n",
       "       male      0\n",
       "55.00  female    1\n",
       "       male      0\n",
       "55.50  male      0\n",
       "56.00  female    1\n",
       "       male      1\n",
       "57.00  female    0\n",
       "       male      0\n",
       "58.00  female    3\n",
       "       male      0\n",
       "59.00  male      0\n",
       "60.00  female    1\n",
       "       male      1\n",
       "61.00  male      0\n",
       "62.00  female    1\n",
       "       male      1\n",
       "63.00  female    2\n",
       "64.00  male      0\n",
       "65.00  male      0\n",
       "66.00  male      0\n",
       "70.00  male      0\n",
       "70.50  male      0\n",
       "71.00  male      0\n",
       "74.00  male      0\n",
       "80.00  male      1\n",
       "Name: Survived, Length: 145, dtype: int64"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sex_age_group.Survived.sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{(Interval(20.0, 30.0, closed='right'),\n",
       "  'male'): Int64Index([  0,  23,  34,  37,  51,  57,  60,  69,  72,  73,\n",
       "             ...\n",
       "             833, 836, 848, 861, 864, 870, 883, 884, 886, 889],\n",
       "            dtype='int64', length=149),\n",
       " (Interval(30.0, 40.0, closed='right'),\n",
       "  'female'): Int64Index([  1,   3,  18,  25,  40,  61,  85,  98, 123, 161, 190, 211, 215,\n",
       "             218, 230, 258, 269, 279, 318, 319, 325, 327, 328, 346, 357, 383,\n",
       "             387, 396, 412, 416, 472, 486, 503, 506, 516, 518, 540, 558, 559,\n",
       "             576, 577, 581, 609, 610, 657, 670, 716, 759, 763, 767, 797, 801,\n",
       "             809, 835, 885],\n",
       "            dtype='int64'),\n",
       " (Interval(20.0, 30.0, closed='right'),\n",
       "  'female'): Int64Index([  2,   8,  41,  53,  56,  66,  79,  88, 100, 106, 133, 141, 142,\n",
       "             151, 199, 216, 246, 247, 251, 255, 257, 289, 290, 293, 309, 310,\n",
       "             312, 315, 316, 322, 323, 341, 345, 356, 369, 376, 393, 394, 399,\n",
       "             402, 423, 426, 436, 437, 443, 473, 474, 498, 501, 520, 534, 537,\n",
       "             539, 554, 567, 580, 600, 608, 615, 617, 627, 635, 641, 649, 708,\n",
       "             710, 717, 726, 729, 730, 742, 747, 799, 816, 823, 842, 858, 866,\n",
       "             874, 880, 882],\n",
       "            dtype='int64'),\n",
       " (Interval(30.0, 40.0, closed='right'),\n",
       "  'male'): Int64Index([  4,  13,  20,  21,  30,  70,  74,  99, 103, 104, 108, 122, 130,\n",
       "             137, 148, 179, 188, 189, 202, 206, 209, 224, 239, 248, 263, 265,\n",
       "             273, 285, 292, 332, 344, 360, 363, 382, 390, 400, 405, 429, 439,\n",
       "             447, 450, 461, 465, 471, 476, 512, 519, 528, 543, 548, 561, 569,\n",
       "             572, 579, 583, 590, 594, 595, 604, 605, 614, 616, 632, 636, 637,\n",
       "             661, 663, 665, 671, 673, 679, 690, 701, 705, 719, 722, 737, 741,\n",
       "             744, 749, 752, 758, 769, 795, 800, 805, 806, 808, 811, 812, 814,\n",
       "             817, 822, 838, 843, 847, 867, 872, 881, 890],\n",
       "            dtype='int64'),\n",
       " (nan, 'male'): Int64Index([  5,  17,  26,  29,  36,  42,  45,  46,  48,  55,\n",
       "             ...\n",
       "             825, 826, 828, 832, 837, 839, 846, 859, 868, 878],\n",
       "            dtype='int64', length=124),\n",
       " (Interval(50.0, 60.0, closed='right'),\n",
       "  'male'): Int64Index([  6,  94, 124, 150, 152, 155, 174, 222, 232, 249, 262, 317, 406,\n",
       "             449, 467, 487, 492, 582, 587, 626, 631, 647, 659, 684, 694, 695,\n",
       "             714, 857],\n",
       "            dtype='int64'),\n",
       " (Interval(0.0, 10.0, closed='right'),\n",
       "  'male'): Int64Index([  7,  16,  50,  63,  78, 164, 165, 171, 182, 183, 193, 261, 278,\n",
       "             305, 340, 348, 386, 407, 445, 480, 489, 549, 751, 755, 787, 788,\n",
       "             803, 819, 824, 827, 831, 850, 869],\n",
       "            dtype='int64'),\n",
       " (Interval(10.0, 20.0, closed='right'),\n",
       "  'female'): Int64Index([  9,  14,  22,  38,  39,  44,  49,  68,  71,  84, 111, 113, 114,\n",
       "             136, 156, 192, 208, 291, 307, 311, 329, 389, 404, 417, 427, 435,\n",
       "             446, 504, 542, 546, 585, 651, 654, 677, 689, 700, 702, 780, 781,\n",
       "             786, 807, 830, 853, 855, 875, 887],\n",
       "            dtype='int64'),\n",
       " (Interval(0.0, 10.0, closed='right'),\n",
       "  'female'): Int64Index([ 10,  24,  43,  58, 119, 147, 172, 184, 205, 233, 237, 297, 374,\n",
       "             381, 419, 448, 469, 479, 530, 535, 541, 618, 634, 642, 644, 691,\n",
       "             720, 750, 777, 813, 852],\n",
       "            dtype='int64'),\n",
       " (Interval(50.0, 60.0, closed='right'),\n",
       "  'female'): Int64Index([11, 15, 195, 268, 366, 496, 513, 571, 591, 765, 772, 774, 820,\n",
       "             879],\n",
       "            dtype='int64'),\n",
       " (Interval(10.0, 20.0, closed='right'),\n",
       "  'male'): Int64Index([ 12,  27,  59,  67,  86,  91, 125, 131, 138, 143, 144, 145, 163,\n",
       "             175, 191, 204, 220, 226, 228, 238, 266, 282, 283, 302, 333, 352,\n",
       "             371, 372, 378, 379, 385, 424, 433, 441, 500, 505, 532, 550, 566,\n",
       "             574, 575, 622, 640, 646, 664, 675, 682, 683, 686, 687, 688, 715,\n",
       "             721, 725, 731, 746, 748, 757, 762, 764, 775, 791, 802, 834, 840,\n",
       "             841, 844, 876, 877],\n",
       "            dtype='int64'),\n",
       " (nan,\n",
       "  'female'): Int64Index([ 19,  28,  31,  32,  47,  82, 109, 128, 140, 166, 180, 186, 198,\n",
       "             229, 235, 240, 241, 256, 264, 274, 300, 303, 306, 330, 334, 347,\n",
       "             358, 359, 367, 368, 375, 409, 415, 431, 457, 485, 502, 533, 564,\n",
       "             573, 578, 593, 596, 612, 653, 669, 680, 697, 727, 792, 849, 863,\n",
       "             888],\n",
       "            dtype='int64'),\n",
       " (Interval(60.0, 70.0, closed='right'),\n",
       "  'male'): Int64Index([33, 54, 170, 252, 280, 326, 438, 456, 545, 555, 570, 625, 672,\n",
       "             745],\n",
       "            dtype='int64'),\n",
       " (Interval(40.0, 50.0, closed='right'),\n",
       "  'male'): Int64Index([ 35,  62,  92, 110, 129, 149, 153, 160, 187, 197, 203, 217, 236,\n",
       "             245, 288, 314, 331, 338, 339, 349, 397, 414, 434, 453, 460, 462,\n",
       "             463, 482, 515, 525, 536, 544, 586, 592, 597, 599, 603, 621, 645,\n",
       "             660, 662, 668, 696, 698, 699, 707, 712, 723, 761, 771, 789, 818,\n",
       "             845, 860, 873],\n",
       "            dtype='int64'),\n",
       " (Interval(40.0, 50.0, closed='right'),\n",
       "  'female'): Int64Index([ 52, 132, 167, 177, 194, 254, 259, 272, 276, 299, 337, 362, 380,\n",
       "             432, 440, 458, 523, 526, 556, 638, 678, 706, 736, 754, 779, 796,\n",
       "             854, 856, 862, 865, 871],\n",
       "            dtype='int64'),\n",
       " (Interval(70.0, 80.0, closed='right'),\n",
       "  'male'): Int64Index([96, 116, 493, 630, 851], dtype='int64'),\n",
       " (Interval(60.0, 70.0, closed='right'),\n",
       "  'female'): Int64Index([275, 483, 829], dtype='int64')}"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bins = np.arange(0, 110, 10)\n",
    "age_bins = pd.cut(titanic.Age, bins)\n",
    "sex_age_group2 = titanic.groupby([age_bins, titanic.Sex])\n",
    "sex_age_group2.groups"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Age       Sex   \n",
       "(0, 10]   female    19\n",
       "          male      19\n",
       "(10, 20]  female    34\n",
       "          male      10\n",
       "(20, 30]  female    61\n",
       "          male      23\n",
       "(30, 40]  female    46\n",
       "          male      23\n",
       "(40, 50]  female    21\n",
       "          male      12\n",
       "(50, 60]  female    13\n",
       "          male       4\n",
       "(60, 70]  female     3\n",
       "          male       1\n",
       "(70, 80]  male       1\n",
       "Name: Survived, dtype: int64"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sex_age_group2.Survived.sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "sex_age_group3 = titanic.groupby"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{(20.0, 'male'): Int64Index([  0,  12,  23,  34,  37,  51,  57,  60,  69,  72,\n",
       "             ...\n",
       "             840, 848, 861, 864, 870, 876, 883, 884, 886, 889],\n",
       "            dtype='int64', length=148),\n",
       " (nan, 'male'): Int64Index([524], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([527], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([531], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([533], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([538], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([547], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([552], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([557], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([560], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([522], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([563], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([568], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([573], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([578], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([584], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([589], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([593], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([596], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([598], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([601], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([564], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([602], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([517], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([507], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([420], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([425], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([428], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([431], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([444], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([451], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([454], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([457], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([459], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([511], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([464], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([468], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([470], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([475], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([481], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([485], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([490], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([495], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([497], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([502], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([466], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([611], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([612], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([613], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([768], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([773], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([776], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([778], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([783], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([790], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([792], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([793], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([815], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([766], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([825], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([828], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([832], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([837], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([839], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([846], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([849], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([859], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([863], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([868], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([826], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([760], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([740], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([739], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([629], dtype='int64'),\n",
       " (80.0, 'male'): Int64Index([630], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([633], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([639], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([643], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([648], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([650], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([653], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([656], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([667], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([669], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([674], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([680], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([692], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([697], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([709], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([711], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([718], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([727], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([732], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([738], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([415], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([878], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([413], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([410], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([47], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([48], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([55], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([64], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([65], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([76], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([77], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([82], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([87], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([46], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([95], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([101], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([107], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([109], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([121], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([126], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([128], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([140], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([154], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([158], dtype='int64'),\n",
       " (70.0, 'male'): Int64Index([96, 116, 493, 672, 745, 851], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([159], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([45], dtype='int64'),\n",
       " (20.0,\n",
       "  'female'): Int64Index([  2,   8,  41,  53,  56,  66,  88, 100, 106, 113, 133, 141, 142,\n",
       "             151, 199, 216, 246, 247, 251, 255, 289, 290, 293, 310, 312, 315,\n",
       "             316, 323, 341, 345, 356, 369, 376, 393, 394, 399, 402, 404, 423,\n",
       "             426, 436, 437, 443, 473, 474, 498, 501, 539, 554, 567, 580, 600,\n",
       "             608, 615, 617, 627, 635, 641, 649, 708, 710, 717, 729, 730, 742,\n",
       "             816, 823, 858, 866, 874, 880, 882],\n",
       "            dtype='int64'),\n",
       " (30.0,\n",
       "  'female'): Int64Index([  1,   3,  18,  25,  61,  79,  85,  98, 123, 190, 211, 215, 218,\n",
       "             230, 257, 258, 269, 279, 309, 318, 322, 325, 327, 328, 357, 383,\n",
       "             387, 396, 412, 416, 472, 486, 503, 506, 516, 518, 520, 534, 537,\n",
       "             540, 558, 559, 576, 577, 581, 610, 657, 716, 726, 747, 759, 763,\n",
       "             767, 797, 799, 801, 809, 835, 842, 885],\n",
       "            dtype='int64'),\n",
       " (30.0, 'male'): Int64Index([  4,  13,  20,  21,  70,  74,  99, 103, 104, 108,\n",
       "             ...\n",
       "             814, 817, 822, 838, 843, 847, 867, 872, 881, 890],\n",
       "            dtype='int64', length=107),\n",
       " (40.0,\n",
       "  'female'): Int64Index([ 40,  52, 132, 161, 167, 194, 254, 272, 276, 319, 337, 346, 362,\n",
       "             380, 432, 440, 523, 556, 609, 638, 670, 678, 706, 736, 754, 779,\n",
       "             796, 854, 856, 862, 865, 871],\n",
       "            dtype='int64'),\n",
       " (nan, 'male'): Int64Index([5], dtype='int64'),\n",
       " (0.0,\n",
       "  'female'): Int64Index([ 10,  24,  43,  58, 119, 147, 172, 184, 205, 233, 237, 297, 374,\n",
       "             381, 448, 469, 479, 530, 535, 541, 618, 634, 642, 644, 691, 720,\n",
       "             750, 777, 813, 852],\n",
       "            dtype='int64'),\n",
       " (0.0,\n",
       "  'male'): Int64Index([  7,  16,  50,  63,  78, 164, 165, 171, 182, 183, 193, 261, 278,\n",
       "             305, 340, 348, 386, 407, 445, 480, 489, 549, 751, 755, 787, 788,\n",
       "             803, 824, 827, 831, 850, 869],\n",
       "            dtype='int64'),\n",
       " (10.0,\n",
       "  'female'): Int64Index([  9,  14,  22,  38,  39,  44,  49,  68,  71,  84, 111, 114, 136,\n",
       "             156, 192, 208, 291, 307, 311, 329, 389, 417, 419, 427, 435, 446,\n",
       "             504, 542, 546, 585, 651, 654, 677, 689, 700, 702, 780, 781, 786,\n",
       "             807, 830, 853, 855, 875, 887],\n",
       "            dtype='int64'),\n",
       " (50.0,\n",
       "  'female'): Int64Index([ 11,  15, 177, 195, 259, 268, 299, 458, 496, 513, 526, 571, 591,\n",
       "             765, 772, 774, 820, 879],\n",
       "            dtype='int64'),\n",
       " (50.0,\n",
       "  'male'): Int64Index([  6,  94, 124, 150, 152, 155, 174, 222, 232, 249, 262, 317, 406,\n",
       "             434, 449, 467, 482, 487, 492, 544, 582, 626, 631, 647, 659, 660,\n",
       "             695, 714, 723, 857],\n",
       "            dtype='int64'),\n",
       " (nan, 'male'): Int64Index([42], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([17], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([26], dtype='int64'),\n",
       " (10.0,\n",
       "  'male'): Int64Index([ 27,  59,  67,  86, 125, 138, 143, 144, 145, 163, 175, 191, 204,\n",
       "             220, 226, 228, 238, 266, 282, 283, 302, 333, 352, 371, 372, 379,\n",
       "             385, 424, 433, 500, 505, 532, 550, 566, 574, 575, 646, 675, 683,\n",
       "             686, 687, 688, 715, 721, 731, 746, 748, 757, 764, 775, 791, 802,\n",
       "             819, 834, 841, 844, 877],\n",
       "            dtype='int64'),\n",
       " (nan, 'female'): Int64Index([28], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([29], dtype='int64'),\n",
       " (40.0,\n",
       "  'male'): Int64Index([ 30,  35,  62,  92, 110, 129, 149, 153, 160, 187, 188, 197, 203,\n",
       "             209, 217, 236, 245, 263, 288, 314, 331, 338, 339, 349, 360, 397,\n",
       "             414, 453, 460, 462, 463, 515, 525, 536, 561, 586, 592, 597, 599,\n",
       "             603, 621, 645, 661, 662, 668, 696, 698, 699, 707, 712, 761, 771,\n",
       "             789, 818, 845, 860, 873],\n",
       "            dtype='int64'),\n",
       " (nan, 'female'): Int64Index([31], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([32], dtype='int64'),\n",
       " (60.0,\n",
       "  'male'): Int64Index([33, 54, 170, 252, 280, 326, 438, 456, 545, 555, 570, 587, 625, 684,\n",
       "             694],\n",
       "            dtype='int64'),\n",
       " (nan, 'male'): Int64Index([36], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([19], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([166], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([168], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([176], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([301], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([303], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([304], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([306], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([324], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([330], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([334], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([335], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([347], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([300], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([351], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([358], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([359], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([364], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([367], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([368], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([375], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([384], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([388], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([409], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([354], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([298], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([295], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([284], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([180], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([181], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([185], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([186], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([196], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([198], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([201], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([214], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([223], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([229], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([235], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([240], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([241], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([250], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([256], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([260], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([264], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([270], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([274], dtype='int64'),\n",
       " (60.0, 'female'): Int64Index([275, 366, 483, 829], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([277], dtype='int64'),\n",
       " (nan, 'male'): Int64Index([411], dtype='int64'),\n",
       " (nan, 'female'): Int64Index([888], dtype='int64')}"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def get_group(index):\n",
    "    row = titanic.loc[index]\n",
    "    if np.isnan(row.Age): return np.nan\n",
    "    return int(row.Age) - (int(row.Age) % 10)\n",
    "\n",
    "sex_age_group3 = titanic.groupby([get_group, titanic.Sex])\n",
    "\n",
    "sex_age_group3.groups"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "      Sex   \n",
       "0.0   female    19\n",
       "      male      19\n",
       "10.0  female    34\n",
       "      male       7\n",
       "20.0  female    52\n",
       "      male      25\n",
       "30.0  female    50\n",
       "      male      23\n",
       "40.0  female    22\n",
       "      male      12\n",
       "50.0  female    16\n",
       "      male       4\n",
       "60.0  female     4\n",
       "      male       2\n",
       "70.0  male       0\n",
       "80.0  male       1\n",
       "Name: Survived, dtype: int64"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sex_age_group3.Survived.sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>Survived</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th>Sex</th>\n",
       "      <th>Survived</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"4\" valign=\"top\">0.0</th>\n",
       "      <th rowspan=\"2\" valign=\"top\">female</th>\n",
       "      <th>0</th>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">male</th>\n",
       "      <th>0</th>\n",
       "      <td>13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"4\" valign=\"top\">10.0</th>\n",
       "      <th rowspan=\"2\" valign=\"top\">female</th>\n",
       "      <th>0</th>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>34</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">male</th>\n",
       "      <th>0</th>\n",
       "      <td>50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"4\" valign=\"top\">20.0</th>\n",
       "      <th rowspan=\"2\" valign=\"top\">female</th>\n",
       "      <th>0</th>\n",
       "      <td>20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>52</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">male</th>\n",
       "      <th>0</th>\n",
       "      <td>123</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"4\" valign=\"top\">30.0</th>\n",
       "      <th rowspan=\"2\" valign=\"top\">female</th>\n",
       "      <th>0</th>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">male</th>\n",
       "      <th>0</th>\n",
       "      <td>84</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"4\" valign=\"top\">40.0</th>\n",
       "      <th rowspan=\"2\" valign=\"top\">female</th>\n",
       "      <th>0</th>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">male</th>\n",
       "      <th>0</th>\n",
       "      <td>45</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"4\" valign=\"top\">50.0</th>\n",
       "      <th rowspan=\"2\" valign=\"top\">female</th>\n",
       "      <th>0</th>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">male</th>\n",
       "      <th>0</th>\n",
       "      <td>26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">60.0</th>\n",
       "      <th>female</th>\n",
       "      <th>1</th>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">male</th>\n",
       "      <th>0</th>\n",
       "      <td>13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>70.0</th>\n",
       "      <th>male</th>\n",
       "      <th>0</th>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>80.0</th>\n",
       "      <th>male</th>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                      Survived\n",
       "     Sex    Survived          \n",
       "0.0  female 0               11\n",
       "            1               19\n",
       "     male   0               13\n",
       "            1               19\n",
       "10.0 female 0               11\n",
       "            1               34\n",
       "     male   0               50\n",
       "            1                7\n",
       "20.0 female 0               20\n",
       "            1               52\n",
       "     male   0              123\n",
       "            1               25\n",
       "30.0 female 0               10\n",
       "            1               50\n",
       "     male   0               84\n",
       "            1               23\n",
       "40.0 female 0               10\n",
       "            1               22\n",
       "     male   0               45\n",
       "            1               12\n",
       "50.0 female 0                2\n",
       "            1               16\n",
       "     male   0               26\n",
       "            1                4\n",
       "60.0 female 1                4\n",
       "     male   0               13\n",
       "            1                2\n",
       "70.0 male   0                6\n",
       "80.0 male   1                1"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "titanic.groupby([get_group, titanic.Sex, titanic.Survived])[['Survived']].count()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>PassengerId</th>\n",
       "      <th>Survived</th>\n",
       "      <th>Pclass</th>\n",
       "      <th>Name</th>\n",
       "      <th>Sex</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Ticket</th>\n",
       "      <th>Fare</th>\n",
       "      <th>Cabin</th>\n",
       "      <th>Embarked</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>15</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Vestrom, Miss. Hulda Amanda Adolfina</td>\n",
       "      <td>female</td>\n",
       "      <td>14.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>350406</td>\n",
       "      <td>7.8542</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>19</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Vander Planke, Mrs. Julius (Emelia Maria Vande...</td>\n",
       "      <td>female</td>\n",
       "      <td>31.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>345763</td>\n",
       "      <td>18.0000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>25</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Palsson, Miss. Torborg Danira</td>\n",
       "      <td>female</td>\n",
       "      <td>8.0</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>349909</td>\n",
       "      <td>21.0750</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>39</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Vander Planke, Miss. Augusta Maria</td>\n",
       "      <td>female</td>\n",
       "      <td>18.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>345764</td>\n",
       "      <td>18.0000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>41</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Ahlin, Mrs. Johan (Johanna Persdotter Larsson)</td>\n",
       "      <td>female</td>\n",
       "      <td>40.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>7546</td>\n",
       "      <td>9.4750</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41</th>\n",
       "      <td>42</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>Turpin, Mrs. William John Robert (Dorothy Ann ...</td>\n",
       "      <td>female</td>\n",
       "      <td>27.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>11668</td>\n",
       "      <td>21.0000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49</th>\n",
       "      <td>50</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Arnold-Franchi, Mrs. Josef (Josefine Franchi)</td>\n",
       "      <td>female</td>\n",
       "      <td>18.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>349237</td>\n",
       "      <td>17.8000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>71</th>\n",
       "      <td>72</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Goodwin, Miss. Lillian Amy</td>\n",
       "      <td>female</td>\n",
       "      <td>16.0</td>\n",
       "      <td>5</td>\n",
       "      <td>2</td>\n",
       "      <td>CA 2144</td>\n",
       "      <td>46.9000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>100</th>\n",
       "      <td>101</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Petranec, Miss. Matilda</td>\n",
       "      <td>female</td>\n",
       "      <td>28.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>349245</td>\n",
       "      <td>7.8958</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>111</th>\n",
       "      <td>112</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Zabour, Miss. Hileni</td>\n",
       "      <td>female</td>\n",
       "      <td>14.5</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2665</td>\n",
       "      <td>14.4542</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>113</th>\n",
       "      <td>114</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Jussila, Miss. Katriina</td>\n",
       "      <td>female</td>\n",
       "      <td>20.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>4136</td>\n",
       "      <td>9.8250</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>114</th>\n",
       "      <td>115</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Attalah, Miss. Malake</td>\n",
       "      <td>female</td>\n",
       "      <td>17.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2627</td>\n",
       "      <td>14.4583</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>119</th>\n",
       "      <td>120</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Andersson, Miss. Ellis Anna Maria</td>\n",
       "      <td>female</td>\n",
       "      <td>2.0</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>347082</td>\n",
       "      <td>31.2750</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>132</th>\n",
       "      <td>133</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Robins, Mrs. Alexander A (Grace Charity Laury)</td>\n",
       "      <td>female</td>\n",
       "      <td>47.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>A/5. 3337</td>\n",
       "      <td>14.5000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>140</th>\n",
       "      <td>141</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Boulos, Mrs. Joseph (Sultana)</td>\n",
       "      <td>female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>2678</td>\n",
       "      <td>15.2458</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>147</th>\n",
       "      <td>148</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Ford, Miss. Robina Maggie \"Ruby\"</td>\n",
       "      <td>female</td>\n",
       "      <td>9.0</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>W./C. 6608</td>\n",
       "      <td>34.3750</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>167</th>\n",
       "      <td>168</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Skoog, Mrs. William (Anna Bernhardina Karlsson)</td>\n",
       "      <td>female</td>\n",
       "      <td>45.0</td>\n",
       "      <td>1</td>\n",
       "      <td>4</td>\n",
       "      <td>347088</td>\n",
       "      <td>27.9000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>177</th>\n",
       "      <td>178</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>Isham, Miss. Ann Elizabeth</td>\n",
       "      <td>female</td>\n",
       "      <td>50.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>PC 17595</td>\n",
       "      <td>28.7125</td>\n",
       "      <td>C49</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>180</th>\n",
       "      <td>181</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Sage, Miss. Constance Gladys</td>\n",
       "      <td>female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>8</td>\n",
       "      <td>2</td>\n",
       "      <td>CA. 2343</td>\n",
       "      <td>69.5500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>199</th>\n",
       "      <td>200</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>Yrois, Miss. Henriette (\"Mrs Harbeck\")</td>\n",
       "      <td>female</td>\n",
       "      <td>24.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>248747</td>\n",
       "      <td>13.0000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>205</th>\n",
       "      <td>206</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Strom, Miss. Telma Matilda</td>\n",
       "      <td>female</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>347054</td>\n",
       "      <td>10.4625</td>\n",
       "      <td>G6</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>229</th>\n",
       "      <td>230</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Lefebre, Miss. Mathilde</td>\n",
       "      <td>female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>4133</td>\n",
       "      <td>25.4667</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>235</th>\n",
       "      <td>236</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Harknett, Miss. Alice Phoebe</td>\n",
       "      <td>female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>W./C. 6609</td>\n",
       "      <td>7.5500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>240</th>\n",
       "      <td>241</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Zabour, Miss. Thamine</td>\n",
       "      <td>female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2665</td>\n",
       "      <td>14.4542</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>246</th>\n",
       "      <td>247</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Lindahl, Miss. Agda Thorilda Viktoria</td>\n",
       "      <td>female</td>\n",
       "      <td>25.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>347071</td>\n",
       "      <td>7.7750</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>251</th>\n",
       "      <td>252</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Strom, Mrs. Wilhelm (Elna Matilda Persson)</td>\n",
       "      <td>female</td>\n",
       "      <td>29.0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>347054</td>\n",
       "      <td>10.4625</td>\n",
       "      <td>G6</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>254</th>\n",
       "      <td>255</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Rosblom, Mrs. Viktor (Helena Wilhelmina)</td>\n",
       "      <td>female</td>\n",
       "      <td>41.0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>370129</td>\n",
       "      <td>20.2125</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>264</th>\n",
       "      <td>265</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Henry, Miss. Delia</td>\n",
       "      <td>female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>382649</td>\n",
       "      <td>7.7500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Q</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>276</th>\n",
       "      <td>277</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Lindblom, Miss. Augusta Charlotta</td>\n",
       "      <td>female</td>\n",
       "      <td>45.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>347073</td>\n",
       "      <td>7.7500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>293</th>\n",
       "      <td>294</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Haas, Miss. Aloisia</td>\n",
       "      <td>female</td>\n",
       "      <td>24.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>349236</td>\n",
       "      <td>8.8500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>542</th>\n",
       "      <td>543</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Andersson, Miss. Sigrid Elisabeth</td>\n",
       "      <td>female</td>\n",
       "      <td>11.0</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>347082</td>\n",
       "      <td>31.2750</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>564</th>\n",
       "      <td>565</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Meanwell, Miss. (Marion Ogden)</td>\n",
       "      <td>female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>SOTON/O.Q. 392087</td>\n",
       "      <td>8.0500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>567</th>\n",
       "      <td>568</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Palsson, Mrs. Nils (Alma Cornelia Berglund)</td>\n",
       "      <td>female</td>\n",
       "      <td>29.0</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>349909</td>\n",
       "      <td>21.0750</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>578</th>\n",
       "      <td>579</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Caram, Mrs. Joseph (Maria Elias)</td>\n",
       "      <td>female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2689</td>\n",
       "      <td>14.4583</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>593</th>\n",
       "      <td>594</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Bourke, Miss. Mary</td>\n",
       "      <td>female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>364848</td>\n",
       "      <td>7.7500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Q</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>610</th>\n",
       "      <td>611</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Andersson, Mrs. Anders Johan (Alfrida Konstant...</td>\n",
       "      <td>female</td>\n",
       "      <td>39.0</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "      <td>347082</td>\n",
       "      <td>31.2750</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>617</th>\n",
       "      <td>618</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Lobb, Mrs. William Arthur (Cordelia K Stanlick)</td>\n",
       "      <td>female</td>\n",
       "      <td>26.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>A/5. 3336</td>\n",
       "      <td>16.1000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>634</th>\n",
       "      <td>635</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Skoog, Miss. Mabel</td>\n",
       "      <td>female</td>\n",
       "      <td>9.0</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>347088</td>\n",
       "      <td>27.9000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>638</th>\n",
       "      <td>639</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Panula, Mrs. Juha (Maria Emilia Ojala)</td>\n",
       "      <td>female</td>\n",
       "      <td>41.0</td>\n",
       "      <td>0</td>\n",
       "      <td>5</td>\n",
       "      <td>3101295</td>\n",
       "      <td>39.6875</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>642</th>\n",
       "      <td>643</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Skoog, Miss. Margit Elizabeth</td>\n",
       "      <td>female</td>\n",
       "      <td>2.0</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>347088</td>\n",
       "      <td>27.9000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>654</th>\n",
       "      <td>655</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Hegarty, Miss. Hanora \"Nora\"</td>\n",
       "      <td>female</td>\n",
       "      <td>18.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>365226</td>\n",
       "      <td>6.7500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Q</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>657</th>\n",
       "      <td>658</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Bourke, Mrs. John (Catherine)</td>\n",
       "      <td>female</td>\n",
       "      <td>32.0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>364849</td>\n",
       "      <td>15.5000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Q</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>678</th>\n",
       "      <td>679</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Goodwin, Mrs. Frederick (Augusta Tyler)</td>\n",
       "      <td>female</td>\n",
       "      <td>43.0</td>\n",
       "      <td>1</td>\n",
       "      <td>6</td>\n",
       "      <td>CA 2144</td>\n",
       "      <td>46.9000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>680</th>\n",
       "      <td>681</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Peters, Miss. Katie</td>\n",
       "      <td>female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>330935</td>\n",
       "      <td>8.1375</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Q</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>702</th>\n",
       "      <td>703</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Barbara, Miss. Saiide</td>\n",
       "      <td>female</td>\n",
       "      <td>18.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>2691</td>\n",
       "      <td>14.4542</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>729</th>\n",
       "      <td>730</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Ilmakangas, Miss. Pieta Sofia</td>\n",
       "      <td>female</td>\n",
       "      <td>25.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>STON/O2. 3101271</td>\n",
       "      <td>7.9250</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>736</th>\n",
       "      <td>737</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Ford, Mrs. Edward (Margaret Ann Watson)</td>\n",
       "      <td>female</td>\n",
       "      <td>48.0</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>W./C. 6608</td>\n",
       "      <td>34.3750</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>767</th>\n",
       "      <td>768</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Mangan, Miss. Mary</td>\n",
       "      <td>female</td>\n",
       "      <td>30.5</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>364850</td>\n",
       "      <td>7.7500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Q</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>772</th>\n",
       "      <td>773</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>Mack, Mrs. (Mary)</td>\n",
       "      <td>female</td>\n",
       "      <td>57.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>S.O./P.P. 3</td>\n",
       "      <td>10.5000</td>\n",
       "      <td>E77</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>792</th>\n",
       "      <td>793</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Sage, Miss. Stella Anna</td>\n",
       "      <td>female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>8</td>\n",
       "      <td>2</td>\n",
       "      <td>CA. 2343</td>\n",
       "      <td>69.5500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>799</th>\n",
       "      <td>800</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Van Impe, Mrs. Jean Baptiste (Rosalie Paula Go...</td>\n",
       "      <td>female</td>\n",
       "      <td>30.0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>345773</td>\n",
       "      <td>24.1500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>807</th>\n",
       "      <td>808</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Pettersson, Miss. Ellen Natalia</td>\n",
       "      <td>female</td>\n",
       "      <td>18.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>347087</td>\n",
       "      <td>7.7750</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>813</th>\n",
       "      <td>814</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Andersson, Miss. Ebba Iris Alfrida</td>\n",
       "      <td>female</td>\n",
       "      <td>6.0</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>347082</td>\n",
       "      <td>31.2750</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>816</th>\n",
       "      <td>817</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Heininen, Miss. Wendla Maria</td>\n",
       "      <td>female</td>\n",
       "      <td>23.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>STON/O2. 3101290</td>\n",
       "      <td>7.9250</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>852</th>\n",
       "      <td>853</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Boulos, Miss. Nourelain</td>\n",
       "      <td>female</td>\n",
       "      <td>9.0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2678</td>\n",
       "      <td>15.2458</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>854</th>\n",
       "      <td>855</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>Carter, Mrs. Ernest Courtenay (Lilian Hughes)</td>\n",
       "      <td>female</td>\n",
       "      <td>44.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>244252</td>\n",
       "      <td>26.0000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>863</th>\n",
       "      <td>864</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Sage, Miss. Dorothy Edith \"Dolly\"</td>\n",
       "      <td>female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>8</td>\n",
       "      <td>2</td>\n",
       "      <td>CA. 2343</td>\n",
       "      <td>69.5500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>882</th>\n",
       "      <td>883</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Dahlberg, Miss. Gerda Ulrika</td>\n",
       "      <td>female</td>\n",
       "      <td>22.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>7552</td>\n",
       "      <td>10.5167</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>885</th>\n",
       "      <td>886</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Rice, Mrs. William (Margaret Norton)</td>\n",
       "      <td>female</td>\n",
       "      <td>39.0</td>\n",
       "      <td>0</td>\n",
       "      <td>5</td>\n",
       "      <td>382652</td>\n",
       "      <td>29.1250</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Q</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>888</th>\n",
       "      <td>889</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Johnston, Miss. Catherine Helen \"Carrie\"</td>\n",
       "      <td>female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>W./C. 6607</td>\n",
       "      <td>23.4500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>81 rows × 12 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     PassengerId  Survived  Pclass  \\\n",
       "14            15         0       3   \n",
       "18            19         0       3   \n",
       "24            25         0       3   \n",
       "38            39         0       3   \n",
       "40            41         0       3   \n",
       "41            42         0       2   \n",
       "49            50         0       3   \n",
       "71            72         0       3   \n",
       "100          101         0       3   \n",
       "111          112         0       3   \n",
       "113          114         0       3   \n",
       "114          115         0       3   \n",
       "119          120         0       3   \n",
       "132          133         0       3   \n",
       "140          141         0       3   \n",
       "147          148         0       3   \n",
       "167          168         0       3   \n",
       "177          178         0       1   \n",
       "180          181         0       3   \n",
       "199          200         0       2   \n",
       "205          206         0       3   \n",
       "229          230         0       3   \n",
       "235          236         0       3   \n",
       "240          241         0       3   \n",
       "246          247         0       3   \n",
       "251          252         0       3   \n",
       "254          255         0       3   \n",
       "264          265         0       3   \n",
       "276          277         0       3   \n",
       "293          294         0       3   \n",
       "..           ...       ...     ...   \n",
       "542          543         0       3   \n",
       "564          565         0       3   \n",
       "567          568         0       3   \n",
       "578          579         0       3   \n",
       "593          594         0       3   \n",
       "610          611         0       3   \n",
       "617          618         0       3   \n",
       "634          635         0       3   \n",
       "638          639         0       3   \n",
       "642          643         0       3   \n",
       "654          655         0       3   \n",
       "657          658         0       3   \n",
       "678          679         0       3   \n",
       "680          681         0       3   \n",
       "702          703         0       3   \n",
       "729          730         0       3   \n",
       "736          737         0       3   \n",
       "767          768         0       3   \n",
       "772          773         0       2   \n",
       "792          793         0       3   \n",
       "799          800         0       3   \n",
       "807          808         0       3   \n",
       "813          814         0       3   \n",
       "816          817         0       3   \n",
       "852          853         0       3   \n",
       "854          855         0       2   \n",
       "863          864         0       3   \n",
       "882          883         0       3   \n",
       "885          886         0       3   \n",
       "888          889         0       3   \n",
       "\n",
       "                                                  Name     Sex   Age  SibSp  \\\n",
       "14                Vestrom, Miss. Hulda Amanda Adolfina  female  14.0      0   \n",
       "18   Vander Planke, Mrs. Julius (Emelia Maria Vande...  female  31.0      1   \n",
       "24                       Palsson, Miss. Torborg Danira  female   8.0      3   \n",
       "38                  Vander Planke, Miss. Augusta Maria  female  18.0      2   \n",
       "40      Ahlin, Mrs. Johan (Johanna Persdotter Larsson)  female  40.0      1   \n",
       "41   Turpin, Mrs. William John Robert (Dorothy Ann ...  female  27.0      1   \n",
       "49       Arnold-Franchi, Mrs. Josef (Josefine Franchi)  female  18.0      1   \n",
       "71                          Goodwin, Miss. Lillian Amy  female  16.0      5   \n",
       "100                            Petranec, Miss. Matilda  female  28.0      0   \n",
       "111                               Zabour, Miss. Hileni  female  14.5      1   \n",
       "113                            Jussila, Miss. Katriina  female  20.0      1   \n",
       "114                              Attalah, Miss. Malake  female  17.0      0   \n",
       "119                  Andersson, Miss. Ellis Anna Maria  female   2.0      4   \n",
       "132     Robins, Mrs. Alexander A (Grace Charity Laury)  female  47.0      1   \n",
       "140                      Boulos, Mrs. Joseph (Sultana)  female   NaN      0   \n",
       "147                   Ford, Miss. Robina Maggie \"Ruby\"  female   9.0      2   \n",
       "167    Skoog, Mrs. William (Anna Bernhardina Karlsson)  female  45.0      1   \n",
       "177                         Isham, Miss. Ann Elizabeth  female  50.0      0   \n",
       "180                       Sage, Miss. Constance Gladys  female   NaN      8   \n",
       "199             Yrois, Miss. Henriette (\"Mrs Harbeck\")  female  24.0      0   \n",
       "205                         Strom, Miss. Telma Matilda  female   2.0      0   \n",
       "229                            Lefebre, Miss. Mathilde  female   NaN      3   \n",
       "235                       Harknett, Miss. Alice Phoebe  female   NaN      0   \n",
       "240                              Zabour, Miss. Thamine  female   NaN      1   \n",
       "246              Lindahl, Miss. Agda Thorilda Viktoria  female  25.0      0   \n",
       "251         Strom, Mrs. Wilhelm (Elna Matilda Persson)  female  29.0      1   \n",
       "254           Rosblom, Mrs. Viktor (Helena Wilhelmina)  female  41.0      0   \n",
       "264                                 Henry, Miss. Delia  female   NaN      0   \n",
       "276                  Lindblom, Miss. Augusta Charlotta  female  45.0      0   \n",
       "293                                Haas, Miss. Aloisia  female  24.0      0   \n",
       "..                                                 ...     ...   ...    ...   \n",
       "542                  Andersson, Miss. Sigrid Elisabeth  female  11.0      4   \n",
       "564                     Meanwell, Miss. (Marion Ogden)  female   NaN      0   \n",
       "567        Palsson, Mrs. Nils (Alma Cornelia Berglund)  female  29.0      0   \n",
       "578                   Caram, Mrs. Joseph (Maria Elias)  female   NaN      1   \n",
       "593                                 Bourke, Miss. Mary  female   NaN      0   \n",
       "610  Andersson, Mrs. Anders Johan (Alfrida Konstant...  female  39.0      1   \n",
       "617    Lobb, Mrs. William Arthur (Cordelia K Stanlick)  female  26.0      1   \n",
       "634                                 Skoog, Miss. Mabel  female   9.0      3   \n",
       "638             Panula, Mrs. Juha (Maria Emilia Ojala)  female  41.0      0   \n",
       "642                      Skoog, Miss. Margit Elizabeth  female   2.0      3   \n",
       "654                       Hegarty, Miss. Hanora \"Nora\"  female  18.0      0   \n",
       "657                      Bourke, Mrs. John (Catherine)  female  32.0      1   \n",
       "678            Goodwin, Mrs. Frederick (Augusta Tyler)  female  43.0      1   \n",
       "680                                Peters, Miss. Katie  female   NaN      0   \n",
       "702                              Barbara, Miss. Saiide  female  18.0      0   \n",
       "729                      Ilmakangas, Miss. Pieta Sofia  female  25.0      1   \n",
       "736            Ford, Mrs. Edward (Margaret Ann Watson)  female  48.0      1   \n",
       "767                                 Mangan, Miss. Mary  female  30.5      0   \n",
       "772                                  Mack, Mrs. (Mary)  female  57.0      0   \n",
       "792                            Sage, Miss. Stella Anna  female   NaN      8   \n",
       "799  Van Impe, Mrs. Jean Baptiste (Rosalie Paula Go...  female  30.0      1   \n",
       "807                    Pettersson, Miss. Ellen Natalia  female  18.0      0   \n",
       "813                 Andersson, Miss. Ebba Iris Alfrida  female   6.0      4   \n",
       "816                       Heininen, Miss. Wendla Maria  female  23.0      0   \n",
       "852                            Boulos, Miss. Nourelain  female   9.0      1   \n",
       "854      Carter, Mrs. Ernest Courtenay (Lilian Hughes)  female  44.0      1   \n",
       "863                  Sage, Miss. Dorothy Edith \"Dolly\"  female   NaN      8   \n",
       "882                       Dahlberg, Miss. Gerda Ulrika  female  22.0      0   \n",
       "885               Rice, Mrs. William (Margaret Norton)  female  39.0      0   \n",
       "888           Johnston, Miss. Catherine Helen \"Carrie\"  female   NaN      1   \n",
       "\n",
       "     Parch             Ticket     Fare Cabin Embarked  \n",
       "14       0             350406   7.8542   NaN        S  \n",
       "18       0             345763  18.0000   NaN        S  \n",
       "24       1             349909  21.0750   NaN        S  \n",
       "38       0             345764  18.0000   NaN        S  \n",
       "40       0               7546   9.4750   NaN        S  \n",
       "41       0              11668  21.0000   NaN        S  \n",
       "49       0             349237  17.8000   NaN        S  \n",
       "71       2            CA 2144  46.9000   NaN        S  \n",
       "100      0             349245   7.8958   NaN        S  \n",
       "111      0               2665  14.4542   NaN        C  \n",
       "113      0               4136   9.8250   NaN        S  \n",
       "114      0               2627  14.4583   NaN        C  \n",
       "119      2             347082  31.2750   NaN        S  \n",
       "132      0          A/5. 3337  14.5000   NaN        S  \n",
       "140      2               2678  15.2458   NaN        C  \n",
       "147      2         W./C. 6608  34.3750   NaN        S  \n",
       "167      4             347088  27.9000   NaN        S  \n",
       "177      0           PC 17595  28.7125   C49        C  \n",
       "180      2           CA. 2343  69.5500   NaN        S  \n",
       "199      0             248747  13.0000   NaN        S  \n",
       "205      1             347054  10.4625    G6        S  \n",
       "229      1               4133  25.4667   NaN        S  \n",
       "235      0         W./C. 6609   7.5500   NaN        S  \n",
       "240      0               2665  14.4542   NaN        C  \n",
       "246      0             347071   7.7750   NaN        S  \n",
       "251      1             347054  10.4625    G6        S  \n",
       "254      2             370129  20.2125   NaN        S  \n",
       "264      0             382649   7.7500   NaN        Q  \n",
       "276      0             347073   7.7500   NaN        S  \n",
       "293      0             349236   8.8500   NaN        S  \n",
       "..     ...                ...      ...   ...      ...  \n",
       "542      2             347082  31.2750   NaN        S  \n",
       "564      0  SOTON/O.Q. 392087   8.0500   NaN        S  \n",
       "567      4             349909  21.0750   NaN        S  \n",
       "578      0               2689  14.4583   NaN        C  \n",
       "593      2             364848   7.7500   NaN        Q  \n",
       "610      5             347082  31.2750   NaN        S  \n",
       "617      0          A/5. 3336  16.1000   NaN        S  \n",
       "634      2             347088  27.9000   NaN        S  \n",
       "638      5            3101295  39.6875   NaN        S  \n",
       "642      2             347088  27.9000   NaN        S  \n",
       "654      0             365226   6.7500   NaN        Q  \n",
       "657      1             364849  15.5000   NaN        Q  \n",
       "678      6            CA 2144  46.9000   NaN        S  \n",
       "680      0             330935   8.1375   NaN        Q  \n",
       "702      1               2691  14.4542   NaN        C  \n",
       "729      0   STON/O2. 3101271   7.9250   NaN        S  \n",
       "736      3         W./C. 6608  34.3750   NaN        S  \n",
       "767      0             364850   7.7500   NaN        Q  \n",
       "772      0        S.O./P.P. 3  10.5000   E77        S  \n",
       "792      2           CA. 2343  69.5500   NaN        S  \n",
       "799      1             345773  24.1500   NaN        S  \n",
       "807      0             347087   7.7750   NaN        S  \n",
       "813      2             347082  31.2750   NaN        S  \n",
       "816      0   STON/O2. 3101290   7.9250   NaN        S  \n",
       "852      1               2678  15.2458   NaN        C  \n",
       "854      0             244252  26.0000   NaN        S  \n",
       "863      2           CA. 2343  69.5500   NaN        S  \n",
       "882      0               7552  10.5167   NaN        S  \n",
       "885      5             382652  29.1250   NaN        Q  \n",
       "888      2         W./C. 6607  23.4500   NaN        S  \n",
       "\n",
       "[81 rows x 12 columns]"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tg = titanic.groupby([titanic.Sex, titanic.Survived])\n",
    "tg.get_group(('female', 0))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
